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); } } } Quote Link to comment 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... Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.