c_pattle Posted July 24, 2010 Share Posted July 24, 2010 I'm wanting to use AJAX to update a form. I have a javascript function that is called and sends this url. The input is the id of an input field and inputvalue is the value in that field. var url = "ajaxformupdate.php?input=" + escape(input) + "&inputvalue=" + escape(input_value); The server then runs this script. I want it to return two values seperated by a "|". However the problem is that I can never get it to add "|images/tick.png" to the variable "src". Can anyone help. $input=$_GET["input"]; $inputvalue=$_GET["inputvalue"]; if ($input == "company_name") { $src .= "company_name_img"; if ($inputvalue) { $src .= "|images/tick.png"; } echo $src; } if ($input == "contact_name") { $src .= "contact_name_img"; if ($inputvalue) { $src .= "|images/tick.png"; } echo $src; } If I haven't explaining anything very well please let me know. Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 24, 2010 Share Posted July 24, 2010 You need to use an actual ampersand ("&") and not "&" in the URL. Otherwise the GET variables are interpreted as 'input' and 'amp;inputvalue' Quote Link to comment Share on other sites More sharing options...
c_pattle Posted July 24, 2010 Author Share Posted July 24, 2010 Thanks for your help although won't that then make my html invalid? Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 24, 2010 Share Posted July 24, 2010 If that code is to be put into an AJAX request then it's not HTML, is it? 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.