• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

retrieving Ajax callback

Guest
Dec 14, 2012 Dec 14, 2012

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?

TOPICS
Advanced techniques

Views

586

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Dec 14, 2012 Dec 14, 2012

Solved this one myself; data = $(data).text();  seems to put the callback data into a form reliably usable by the rest of my functions.

Votes

Translate

Translate
Guest
Dec 14, 2012 Dec 14, 2012

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2012 Dec 15, 2012

Copy link to clipboard

Copied

LATEST

Good for you. Please kindly mark the solution.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation