[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

search for string on page and store it in a variable.

Posted on 2012-03-16
3
Medium Priority
?
214 Views
Last Modified: 2012-03-16
Can you help me  search for a string on a web page and then remove the beginning of the string and then create a variable with the result value using javascript?

So I have a string on the page that begins with "GHID:" then 10 digits.  

How can I search the page for the string "GHID:********" (* - wildcard representing the 10 digits)

Then remove the "GHID:" and create a variable equal to just the 10 remaining numbers?
0
Comment
Question by:ForLoop5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 37731463
>Can you help me  search for a string on MY OWN web page

please confirm
0
 
LVL 1

Author Comment

by:ForLoop5
ID: 37731474
yes it is on my own web page.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 37731493
so with jQuery :
$.get("path/to/your/page.html", function( pageHTML ) {
  var your_10_digits = pageHTML.substr( pageHTML.indexOf("GHID:"), 10);
});

Open in new window


If it don't work, please provide a page to see your page and the code provided
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question