I'm using jQuery's ajax post to post data from a form to an external CRM. There is an ASP.net with a C# code behind that handles the external URL.
I've done AJAX posts using this same method and have never ran into this problem. It works fine on all desktop browsers, but it freezes on iPads/iPhones and just times out on Android devices.
Here is the code for the post:
function mfSubmit(event) {
event.preventDefault();
if (mfValidateForm4() == true) {
$('a#aAction').hide();
$('#mfLoader').show();
var campaignID = "18";
if ($("#campID").val() != undefined) {
campaignID = $("#campID").val();
}
var referID = function () {
var myNumber = "1";
myNumber = 70000000 + Math.floor(Math.random() * 70000000);
return myNumber;
};
//alert("Campaign: " + campaignID);
$.ajax({
type: "POST",
url: "/PostHelper.ashx?target=externalURL" + campaignID,
data: {
FirstName: firstname,
LastName: lastname,
Email: email,
Phone: phone,
PropertyZipcode: zip,
PropertyState: state,
CurrentCity: city,
EstimatedHomeValue: estimatedValue,
LoanAmount: loanAmount,
TransactionType: loanPurpose,
CreditRating: creditScore,
ReferId: referID
},
success: function (msg) {
//alert('SUCCESS');
var newURL = document.location.href;
newURL = newURL.replace('#slide-5', '#slide-6');
document.location.href = newURL;
},
error: function (msg) {
console.log(msg);
//alert('ERROR');
},
datatype: 'text'
});
}
return false;
}
The mfSubmit
function is being called from an 'onclick' that passes the event.
externalURL
is just a placeholder. Also, the response from the server is just 'Success' in text format.
This is working on all desktop browsers, but will consistently freeze on Apple mobile devices and simply Timeout on Android.
Any advice or help is greatly appreciated.