||09-17-2012 07:26 PM
Manipulating ajax data after load
I currently have a script that it uses ajax to search, the results turn up and I have buttons to each result.
document.getElementById('buttonone').innerHTML = "Search Sent";
Works for the button that loaded with the original page
document.getElementById('buttontwo').innerHTML = "Added Ty";
Does not work for the button loaded with ajax
Is there a way to register the new elements on ajax load?
||09-17-2012 08:09 PM
You need to put that into the callback of the AJAX function.
||09-17-2012 08:47 PM
Nm I found it, I had to reinitialize the whole thing after the first return of the ajax so the doc would find it.
||09-17-2012 09:13 PM
Are you open to using jQuery, it would make things a bit simpler.
I'll try to show you what VIPStephan means using a jQuery example:
//we're now inside the callback
//perform actions with data returned from search form
//this is where you can put your event for your button
Your button will have to be on the page: "url-to-my-search.html"
I just ran into this issue myself the other day, and this is how I resolved it.
|All times are GMT +1. The time now is 12:08 PM.
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.