Article 4Y149 can't get AJAX to access request.done function

can't get AJAX to access request.done function

by
pizzipie
from LinuxQuestions.org on (#4Y149)
Hi,
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. I tried the .load() function and got the same results.

Code: <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>latest?d=yIl2AUoC8zA latest?i=GAHn3gE3rjM:q_8vVP1Omx0:F7zBnMy latest?i=GAHn3gE3rjM:q_8vVP1Omx0:V_sGLiP latest?d=qj6IDK7rITs latest?i=GAHn3gE3rjM:q_8vVP1Omx0:gIN9vFwGAHn3gE3rjM
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments