I have a small Ajax code that works very well in IE but do not work under Firefox. I have no error in Firefox console.
Code:
function get_Xhr()
{
if (window.XMLHttpRequest) // Purpose of the current window
{
xhr = new XMLHttpRequest(); // Firefox, Safari, ...
}
else
if (window.ActiveXObject) // Version Active
{
xhr = new ActiveXObject("Microsoft.XMLHTTP" ); // Internet Explorer
}
}
function ajaxclient()
{
get_Xhr();
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4 && xhr.status == 200)
{
document.getElementById('testt').innerHTML = xhr.responseText;
}
}
xhr.open("POST",'ajax/ajax_ajout_client.php',true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.send("cocl="+document.form_ajout_client.name.value);
}
Bookmarks