ajax - JavaScript XMLHttpRequest send fails -
i try make ajax requestin chrome using following code:
var url = "http://" + document.domain + "/status_data.lua?resetsessiontimeout=false"; xmlhttp.open("get", url, true); xmlhttp.send(null); using wireshark see send doesn't send anything... there no get emitted. if add & @ end of url:
var url = "http://" + document.domain + "/status_data.lua?resetsessiontimeout=false&"; ^ then send emit get request.
is expected?
i'm going guess couple of common errors people (and i) have made.
did create instance of xmlhttp? in otherwords, have line before code above has "var xmlhttp = new xmlhttprequest();" (case sensitive)
are testing through file (like c:/test.html) or on webserver (like apache or jboss)? if former, you'll cross point origin error , doing latter fix it.
are sure server code not looking additional variables after resetsessiontimeout? because '&' used delimit additional variables. although i'm pretty sure unneeded end variable.
like if wanted send error string url. can resetsessiontimeout=false&errmsg=test
Comments
Post a Comment