javascript - jQuery $.ajax Not Working in IE8 but it works on FireFox & Chrome -
i have following ajax call works in firefox , chrome not ie:
function getajaxdates( startdate, numberofnights, opts ) { var month = startdate.getmonth() + 1; var day = startdate.getdate(); var year = startdate.getfullyear(); var d = new date(); var randnum = math.floor(math.random()*100000000); $.ajax({ type : "get", datatype : "json", url : "/availability/ajax/bookings?rand="+randnum, cache : false, data : 'month='+month+'&day='+day+'&year='+year+'&nights='+numberofnights, contenttype : 'application/json; charset=utf8', success : function(data) { console.log('@data: '+data); insertcelldata(data, opts, startdate); }, error:function(xhr, status, errorthrown) { console.log('@error: '+errorthrown); console.log('@status: '+status); console.log('@status text: '+xhr.statustext); } }); }
i know fact variables passing right content , $.ajax indeed passing paramater/values.
this on error:
log: @error: undefined log: @status: parsererror log: @status text: ok
i'm aware of cache issue on ie , implemented random paramater clear up.
here json (i'm able see using charles)
{ "availability":[ { "inventory_id":"5", "booking_id":"21", "start_date":"05-01-2010", "number_nights":4, "text":"defrancisco, martin - $500.00 active", "type":"booking" } ] }
finally these headers sent backend:
header('content-type: application/json; charset=utf8'); header("cache-control: no-cache"); header("expires: 0"); header('access-control-max-age: 3628800'); header('access-control-allow-methods: get, post, put, delete');
any ideas?
i comment out contenttype , add datatype: "json"
from http://api.jquery.com/jquery.ajax/
datatype: the type of data you're expecting server.
contenttype: when sending data server, use content-type.
you specifying sending json, not - maybe issue?
Comments
Post a Comment