Codeigniter with Ajax |
[eluser]Joshi[/eluser]
It doesnt seem to be a javascript problem. I am using ajax to call the function. If i run the page that i call in Ajax, i am able to get the values. What happens is after fetching the data, i am unable to pass the values back to the text boxes. I hope i have missed something. Can u recheck my code assuming that i am calling the function in select option.
[eluser]kkith[/eluser]
assuming you are calling the php function and it gets a response, you have this... document.getElementById('bankNameForACH')[removed]=req.responseText; but i don't think that's correct, shouldn't it be... document.getElementById('bankNameForACH').value=req.responseText; ?
[eluser]Joshi[/eluser]
U r right. The text is replaced in that. I have used innerHTML in the place of the value.Both value and innerHTML doesnt seems to work.
[eluser]kkith[/eluser]
Add the alert call...and see if anything happens. If nothing happens then either the ajax call to the handler is making it, or the handler isn't making it back. Code: if (req.status == 200) { [quote author="Joshi" date="1275327516"]U r right. The text is replaced in that. I have used innerHTML in the place of the value.Both value and innerHTML doesnt seems to work.[/quote]
[eluser]Joshi[/eluser]
When i alert i get the following printed.What am i doing wrong in my code. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link REL="SHORTCUT ICON" HREF="/images/fav.ico"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Pay Securely to BBBB through Payment Helpdesk</title> </head> <style type="text/css"> body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; background-color: #626262; } .arial10 { font-family: Arial; font-size: 10px; font-style: normal; font-weight: normal; color: #FF0000; text-decoration: none; } .arial30 { font-family: Arial; font-size: 12px; font-style: normal; font-weight: normal; text-decoration: none; } .arial20 { font-family: Arial; font-size: 18px; font-style: normal; font-weight: bold; color: #000000; text-decoration: none; } .arial20blue { font-family: Arial; font-size: 18px; font-style: normal; font-weight: bold; color: #0A51A1; text-decoration: none; } .tahoma25 { font-family: tahoma; font-size: 25px; font-style: normal; font-weight: bold;
[eluser]Joshi[/eluser]
Please let me know what i am wrong or Is there any other way to do this ?
[eluser]pickupman[/eluser]
If you are getting back html code from your alert(), you are sending a whole html page rather than just the input fields. I would presume that this is happening from $this->load->view(); Using jQuery: Code: $("select[name='accountNoForACH']").change(function(){ jQuery can make this very easy for you. It handles all of the XHR cross browser code for you. All that in 14 lines.
[eluser]Joshi[/eluser]
Thanks for your response. I went through the code u have posted and find it simple when compared to Ajax. can you please let me know how to call the Javascript function in HTML.
[eluser]pickupman[/eluser]
In your <head> tag, add a script tag pointing to your jquery source, then add Code: [removed] The removed blocks would be your opening and closing script tags. |
Welcome Guest, Not a member yet? Register Sign In |