问题描述:

I have a strange problem. Searched for solution but couldn't find anything.

I'm intercepting some 3rd party code on submit (submit cancelled cause method return false).

I want to submit the form when my ajax call is completed so it is not aborted by ongoing submit.

The problem is that success callback is never called. Also in that version of jquery, $.ajax does not return XHTR.

RegisterReservation: function() {

var data = 'HotelName=' + encodeURIComponent($('#resData>div:nth-child(1)').text()) +

'&From=' + encodeURIComponent($('#resData>div:nth-child(3)').text()) +

'&To=' + encodeURIComponent($('#resData>div:nth-child(4)').text()) +

'&TotalPrice=' + encodeURIComponent($('.totalPriceBg').text()) +

'&FirstName=' + encodeURIComponent($('#firstName').val()) +

'&LastName=' + encodeURIComponent($('#lastName').val()) +

'&PhoneNumber=' + encodeURIComponent($('input[name=phoneNumber]').val()) +

'&EmailAddress=' + encodeURIComponent($('input[name=emailAddress]').val());

$.ajax({

url: "http://server/api/WhiteLabel",

data: data,

type: 'GET',

dataType: 'jsonp',

crossDomain: true,

success: function(data){alert("SUCCESS");}

});

Any ideas what is wrong?

相关阅读:
Top