aniesh82 Posted April 25, 2007 Share Posted April 25, 2007 Hello I have a html form with action to paypal's site. When submitting the page, I need to update the table with the form values( USING AJAX) . To do this I write the following code. <script> /* Call this function on the onClick of the submit button */ function check_form_values() { /* Inside this function I check wether the USER enters the details */ ajaxFunction(); /* IT WORKS PERFECTLY IF WE UNCOMMENT THIS ALERT PAGE */ } function ajaxFunction() { append_url = 'contact_info.php?contact_id='+document.form1.user_id.value+'&contact_name='+document.form1.contact_name.value+'&position='+document.form1.position.value+'&email='+document.form1.email.value+'&telephone='+document.form1.telephone.value+'&mobile='+document.form1.mobile.value+'&company='+document.form1.company.value+'&address='+document.form1.address.value; var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { //response_txt = xmlHttp.responseText; } } xmlHttp.open("GET",append_url,true); xmlHttp.send(null); } </script> I am trying to update the table using the contact_id field, I did not return any values from AJAX action page. But this code did not work properly. If I uncomment the alert inside the function "check_form_values()", then updation will work perfectly. Can someone help me to fix this problem ? Regards Aniesh Joseph Quote Link to comment Share on other sites More sharing options...
xenophobia Posted April 25, 2007 Share Posted April 25, 2007 What do you mean alert page? I don't see any alert() function there. ??? Quote Link to comment Share on other sites More sharing options...
colandy Posted April 25, 2007 Share Posted April 25, 2007 I don't see that your doing anything at all with the AJAX returned responseText. I also use AJAX as an object ....... var testObj = new AJAXFunction() Here you appear to be using a function, creating the object inside the function and then doin not a lot with it, there's no check after the send only b4 so I'm assuming that it returns nothing. You don't use contact_id at all even though it's set at the beginning. Just a few suggestions, hope they help Quote Link to comment Share on other sites More sharing options...
Zaxnyd Posted April 27, 2007 Share Posted April 27, 2007 append_url = 'contact_info.php? Might be irrelevant, but I noticed this line needs a closing, like so: append_url = 'contact_info.php?'; 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.