Copy link to clipboard
Copied
I just wrote my first Ajax code, and am looking for a more elegant way to retrieve the callback from the ColdFusion server page. My callback page returns this data: <html><body><div>6</div></body></html> Right now I am using this Javascript to retrieve the 6 from inside the div: (data = string sent by server page) var divloc = data.indexOf('div'); var callback = data.substr(divloc+4,1); Is there a better way to retrieve the 6 from those HTML tags, or could I get the server page to pass just the 6, without the HTML, back to the calling page?
Solved this one myself; data = $(data).text(); seems to put the callback data into a form reliably usable by the rest of my functions.
Copy link to clipboard
Copied
Solved this one myself; data = $(data).text(); seems to put the callback data into a form reliably usable by the rest of my functions.
Copy link to clipboard
Copied
Good for you. Please kindly mark the solution.