Encountering an error in Firefox 31 ESR:
Error: NS_ERROR_FAILURE:
Source file:
Similar issue observed on Internet Explorer 11:
SCRIPT5022: InvalidStateError
The script used for AJAX function call is as follows:
ajax('post','standard/','part='+p+'&price='+q,'sequel_sub_object_key');
Below is the code snippet for the AJAX function:
function ajax(method,url,param_id_container_pos,id_container,id_focus,sequel)
{
var methods = Array('get','head','post');
if (window.XMLHttpRequest && in_array(method,methods))
{
xhr = new XMLHttpRequest();
xhr.open(method,url,true);//Error triggers here for localhost.
if (method=='post')
{
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xhr.send(param_id_container_pos);
}
xhr.send(null);
xhr.onreadystatechange = function()
{console.log('xhr.readyState = '+xhr.readyState);
if (xhr.readyState=='4')
{
alert('xhr.responseText = '+xhr.responseText);
}
}
}
Seems like Firefox and IE suspect cross-site scripting issues even with localhost involved?
Tried both absolute and relative paths for the URL :
document.getElementsByTagName('base')[0].href+'standard/'
window.location.href
'standard'
After going through several pages including Stack, no solution seems to fit.
No intention of implementing cross-site scripting.
Not altering the
method
.Solely using HTTP, not HTTPS.
No involvement of subdomains.
Avoiding frameworks entirely.
Just need the URL to work, regardless of being absolute or relative.
Intranet website scenario.
Server and client are the same computer.
Originating URL format -
http://localhost/Client/standard/?http-query
Target URL -
.http://localhost/Client/standard/
Apache Access log indicates request completion with HTTP 200 response.
An
alert()
postopen
doesn't show all parameters.onreadystatechange states don't get logged in console.
Optional parameters when calling the
ajax
function.
What aspect am I overlooking?