Need help on getting the results from a URL

S

SteveB

Hi everyone!

I'm a complete newbie to JavaScript and I've been tasked to do something
that is seemingly very simple, but I can't quite figure how to do it.

Using JavaScript, I need to call a URL passing it some parameters (this part
I've done), now this URL will return a result like the following...

OK|4540c2aa19a4dddf6ca52c2233b87f31

I need to get that result, strip out the 'OK|' part, and then pass the
remaining string to another URL (again, I've got the passing of parameters
part done). So how can I get this value and store into a variable so that I
can pass it along to another URL?

Thanks!
 
E

Erwin Moller

SteveB said:
Hi everyone!

I'm a complete newbie to JavaScript and I've been tasked to do something
that is seemingly very simple, but I can't quite figure how to do it.

Using JavaScript, I need to call a URL passing it some parameters (this
part I've done), now this URL will return a result like the following...

OK|4540c2aa19a4dddf6ca52c2233b87f31

I need to get that result, strip out the 'OK|' part, and then pass the
remaining string to another URL (again, I've got the passing of parameters
part done). So how can I get this value and store into a variable so that
I can pass it along to another URL?

Thanks!

Hi Steve,

Am I right that you are only asking how to manipulate a string, eg get a
substring?
If yes: have a look at substring and length.
var myStr = "abcdef";
var strLength = myStr.length;
var first5Chars = myStr.substr(0,5);

Regards,
Erwin Moller

PS: Buy a book on JS. I advise O'Reilly 's "Javascript the definite Guide",
4th edition is out now for some time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top