Jump to content

Ajax status code problem


c_pattle

Recommended Posts

I have an AJAX request but my problem is that is always returns a status code of 0.  Below I have my JavaScript function.  They send a request to a page called inc_submit.php which just echo's "hi" (as I'm just try to test it). 

 

function submitForm(website_name, website_caption, website_contact, website_email, website_link) {
	var url4 = "includes/inc_submit.php?website_name=" + escape(website_name) + "&website_caption=" + escape(website_caption) + "&website_contact=" + escape(website_contact) + "&website_email=" + escape(website_email) + "&website_link=" + escape(website_link);
	alert (url4);
	request4.open("GET", url4, true);
	request4.onreadystatechange = confirmSubmit;
	request4.send(null);
}

function confirmSubmit() {
	if (request4.readyState == 4) {
	if (request4.status == 200) {
	var response4 = request4.responseText;
	document.getElementById("submit_status").innerHTML = response4;
} else {
	alert("Error: status code is " + request4.status);
}
}
}

Link to comment
https://forums.phpfreaks.com/topic/213885-ajax-status-code-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.