rad1964 Posted September 10, 2013 Share Posted September 10, 2013 Hello, I want to test that the data that is submitted through a form is being captured. And or a succes message is sent. Attached is the form code (grh.html), javascript (grh.js), form processing (process.php), success page (success.html). Basically I am using AJAX to return the form fields that were filled out. When that didn't work, I added the success page which is also not working. Any ideas? Here is my js file contents since the uploader will not upload a .js file.... //AJAX - Creates the XMLHttpRequest that sends a http request to the web serverfunction getXMLHTTP() { var x = false; try { x = new XMLHttpRequest(); } catch(e) { try { x = new ActiveXObject("Microsoft.XMLHTTP"); } catch(ex) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1) { x = false; } } } return x;}//Retrieves the Forms field values *This is a TEST for diagnostic purposes*function displayFormValues(){ var str = ''; var elem = document.getElementById('formGrh').elements; for(var i = 0; i < elem.length; i++) { str += "<b>Name: </b>" + elem.name + " "; str += "<b>Value: </b>" + elem.value + " "; str += "<br />"; } document.getElementById('lblValues').innerHTML = str;} TIA, rad1964 grh.html process.php successful.html Link to comment https://forums.phpfreaks.com/topic/282051-getting-a-return-success-message-or-returning-the-data-after-submitting-form/ Share on other sites More sharing options...
gristoi Posted September 10, 2013 Share Posted September 10, 2013 it is 2013, not 1993. Use Jquery ajax to make your ajax call. $.ajax({ url: 'yourphpscripturl.php', data: $('#yourform').serialize(), success: function(data){ alert(data.response) } }); Link to comment https://forums.phpfreaks.com/topic/282051-getting-a-return-success-message-or-returning-the-data-after-submitting-form/#findComment-1449032 Share on other sites More sharing options...
rad1964 Posted September 10, 2013 Author Share Posted September 10, 2013 Making that change does not make anything work, thanks for the 2013 version, but 1993 was a good year Link to comment https://forums.phpfreaks.com/topic/282051-getting-a-return-success-message-or-returning-the-data-after-submitting-form/#findComment-1449047 Share on other sites More sharing options...
rad1964 Posted September 11, 2013 Author Share Posted September 11, 2013 I get the javascript data being written to my initial form page (at the bottom) so it is reading the fields properly, The AJAX, does not yet play a part, please ignore that. In my form tag I have an action="process.php" - what is not happening is the successful.html does not show up, which is called at the bottom of my process.php, which makes me think that the process.php is not being read... Newbie here, in case you couldn't tell. thanks, rad1964 Link to comment https://forums.phpfreaks.com/topic/282051-getting-a-return-success-message-or-returning-the-data-after-submitting-form/#findComment-1449141 Share on other sites More sharing options...
rad1964 Posted September 13, 2013 Author Share Posted September 13, 2013 Solved, the submit button had generic button insted of submit. Link to comment https://forums.phpfreaks.com/topic/282051-getting-a-return-success-message-or-returning-the-data-after-submitting-form/#findComment-1449427 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.