0

I am having this weird problem with the following ajax request.

$.ajax({
   type:'POST',
   url:'import_data.php',
   data:'buildquery',
   dataType:'xml',
   success:function(response){
     console.log(response);
   },
complete:function(response){
 console.log(response);
},
error:function(jqXHR,textStatus,errorThrown){
  alert('error');
console.log(textStatus, errorThrown);
}

});

In import_data.php I have some database operations which are executed successfully (this took about 30 mins)and after it prints the following xml file <metaclass> <status>ok</status> </metaclass>

But the problem is I am not getting any response,even after completion of my php execution. The request is still not completed,In firebug request is still in progress...

My response is working fine if the script execution time is less, I mean if import_data.php only takes 2 or 3 mins then I am getting the response.....

Any information will be much appreciated, Thanks in advance.

Subash
  • 165
  • 2
  • 3
  • 13
  • 1
    This sounds more like an issue with your PHP script rather than your AJAX request. What kind of data is being processed and what kind of response is being/should be generated? – Daniel Sep 19 '13 at 16:19
  • Is `import_data.php` in the right folder? Have you confirmed that it's hitting the right URI? Are you sure the string `buildquery` will be interpreted as valid POST input? – Justin Morgan - On strike Sep 19 '13 at 16:19
  • 1
    You could try to create form and do the post request with it just to check if the problem really is in ajax request (if of course you dont have some ajax request check in php and dont want to or cant comment it out). – Jānis Gruzis Sep 19 '13 at 16:22
  • 1
    This link may be helpful in tracking down why you are not getting a response on longer queries. http://stackoverflow.com/questions/18882841/ajax-success-wont-run-function/18882910#18882910 Specifically look at the error: call back. – Trevor Sep 19 '13 at 16:25
  • @Daniel I send the catalog_key value from a select tag , this value is the primary key in my database which tells what user value is to be inserted, I do insert or update database operations and if these operations are successful then the response will be in a xml format, if they are unsuccessful then the error information will be in the response – Subash Sep 19 '13 at 16:26
  • @JustinMorgan The request is sent successfully, I dont see any errors in my sql statements execution – Subash Sep 19 '13 at 16:29
  • 1
    add in `,complete:function(response){ console.log(response); }` to see what's going on – vol7ron Sep 19 '13 at 16:44
  • 1
    How do you get `buildquery` in your PHP script? there has to be a key-value relationship. – MahanGM Sep 19 '13 at 17:21
  • I have a key value relation, my script is working fine if the request takes less time, i am not getting any response if the request takes more time like 30 mins – Subash Sep 19 '13 at 17:52
  • @vol7ron added complete and error but no luck – Subash Sep 19 '13 at 18:03

0 Answers0