c_pattle Posted September 20, 2010 Share Posted September 20, 2010 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 More sharing options...
joel24 Posted September 20, 2010 Share Posted September 20, 2010 have a look at jQuery's $.post and $.ajax... or if you're set on traditional javascript/ajax try this tutorial... Link to comment https://forums.phpfreaks.com/topic/213885-ajax-status-code-problem/#findComment-1113217 Share on other sites More sharing options...
c_pattle Posted September 20, 2010 Author Share Posted September 20, 2010 Thanks. Although I already know how AJAX works. I was just having a small problem. Link to comment https://forums.phpfreaks.com/topic/213885-ajax-status-code-problem/#findComment-1113218 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.