Sending multiple Ajax queries in sequence fails in chrome and Safari

I have an issue were I display a sequence of dialogue or AJAX results that feed from each other. For example. A user will click to send a message that fires an ajax call, a dialogue opens, user fill out the form and sends, dialogue is closed, form is submitted via AJAX, then another AJAX response will either open up a dialogue or redirect the user. This process displays the first dialogue in all browsers but shows an error for the second dialogue in Safari and Chrome. I'm 95% sure it was working find in all browsers. Now it seems to fail. The error function is fired and the browser will then open the URL that was used for the second AJAX request.

I am using jquery, PHP and javascript and I had it running from an eval(json) command. I have since reconstructed the code to return raw Javascript.

In any case the error is fired on the 'error' handler of the AJAX query. The errors returned are very uninformative. I understand that Chrome has a caching process but not sure how may effect this or if it exist in safari. In any case it appears that the second call the ajax fails in safari and chrome before the returned javascript is run. I believe it was working in all browsers before but I'm not so sure now. I've spent almost half a day on it hence I would appreciate some assistance. :D

The Javascript function used to run the AJAX call is as follows

function page(url){
            type: "POST",
            url: url,
            success : ajaxReturn,
            cache: false,
            dataType: 'script',
            error: function(result, status, err) {
                alert('HTTP ' + result.status + ' Error Encountered: ' + result.statusText);
                alert('status: '+status+' error: '+err);


function ajaxReturn(ret){   

This is the same code used on both of the AJAX calls. And in some instances (IE if an error is found in the form) the return code is virtually exactly the same. I have a system in place for all the dialogue, AJAX and associated process which has been working fine till now.

The messages that I get returned from the error handler are:

HTTP 0 Errpr Encountered: error




status:error error:

As outputted via the alert statement. Where is an empty dialogue. Hence due the fact that the same ajax functions are run and the same code is being returned Chrome and Safari are having issues with the second call. Irrespective of what is returned they are failing on the error handler and I have not idea why.


Ok so I found the issues. The content of the form within the dialogue was submitted via another AJAX call. Hence on the onsubmit handler in the from content was serialized via jquery and then send to the AJAX. The thing is that I had not included a return false after the AJAX call in the onsubmit handler. So for some reason on chrome and safari this would return an error status of 0 and then forward me on the page called via AJAX.

Any case return false fixed it. Sweet!

Need Your Help

Missing shadow (hairline) on iOS7 UIToolbar

ios iphone ipad ios7 uitoolbar

In iOS7, UIToolbar does not appear to have a little line (the shadow) on the top or bottom borders, which makes it difficult to distinguish from the rest of the app. How can I restore the shadow at...

How to get efficient Sql Server deadlock handling in C# with ADO?

c# sql-server .net-2.0 deadlock

I have a class 'Database' that works as a wrapper for For instance, when I need to execute a procedure, I call Database.ExecuteProcedure(procedureName, parametersAndItsValues).