How to call GET method with javascript. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

How to call GET method with javascript.

Ex : http://something.com/page.php?name=John How to get "John" With javascript

15th Oct 2017, 3:14 AM
Nikky Amresh
Nikky Amresh - avatar
6 Answers
+ 13
@Nikky I think you may edit the question to "How to get query string value with JavaScript" if your intention is extracting the value "John" from url. Anyway here's a good read: https://stackoverflow.com/q/901115
15th Oct 2017, 5:01 AM
Zephyr Koo
Zephyr Koo - avatar
+ 11
I know that... But I'm asking..." How to get it with javascript" Anyway.. Thanks for sharing your knowledge @niawatha
15th Oct 2017, 4:26 AM
Nikky Amresh
Nikky Amresh - avatar
+ 10
@Zephyr koo. Not at all.. But i had seen this question before
15th Oct 2017, 5:04 AM
Nikky Amresh
Nikky Amresh - avatar
+ 6
Your link already in php file, use php global variable GET is the usual way. I don't think that Javascript could parse body request data, unless you use NodeJs body-parser.
15th Oct 2017, 5:04 AM
Calviղ
Calviղ - avatar
- 1
oh, sorry ;3;
15th Oct 2017, 12:52 PM
LunarCoffee
LunarCoffee - avatar
- 2
You don't. That is done with PHP. https://www.sololearn.com/Course/PHP/ Reference the "Predefined Variables" module, lesson 4 ("GET and POST"). :)
15th Oct 2017, 3:53 AM
LunarCoffee
LunarCoffee - avatar