can't get AJAX to access request.done function
This is related to my last post which I never did figure out. I am sending an AJAX request and am getting a response but not through the request.done function. What happens is that the console shows this:
["Costs","rdata","show","sqlite_sequence"]
Which is the correct data returned from the URL sent to AJAX. The
alert("data returned"+data[0]); is never seen.
-
<script type="text/javascript" >
$("#dbForm").submit(function() {
$("#dbForm").hide();
var dbase=$("#database option:selected").text();
alert('"database":'+dbase ); // ok
var request = $.ajax({
url: "tableTest.php",
method: "post",
data: { "database":dbase},
dataType: "json"
});
request.done(function(data) {
alert("data returned"+data[0]);
});
request.fail(function( jqXHR, textStatus ) {
alert( "Request failed: " + textStatus );
});
</script>