As we know, GET method sends data via URL. We can use both GET and POST method in ajax. My question is, why can't we see the data in URL when we use ajax with a GET method?
Asked
Active
Viewed 1,395 times
1
-
You can - it's in the query string. – Sep 14 '13 at 03:40
-
@MikeW I made a url like = "Controller/Add?name="something"&age="30"; and used in JSON url parameter. JSON uses GET method. But in this case, I cannot see the portion after "?" in my address bar. – Yeasin Abedin Sep 14 '13 at 03:57
2 Answers
3
AJAX call is not visible through url.
Try to use firebug extension of firefox.
In firebug, you will find all request in console.

Jasmin Mistry
- 1,459
- 1
- 18
- 23
-
Thank You for the information. My question is, WHY "AJAX call is not visible through url" ? – Yeasin Abedin Sep 14 '13 at 04:20
-
2AJAX is the art of exchanging data with a server, and updating parts of a web page - without reloading the whole page. page is not reloaded in ajax. – Jasmin Mistry Sep 14 '13 at 04:49
1
When you fire off your ajax request like this:
The Chrome network tab will show new line for this transaction:
If you click on it, it will show you all the details:
If you'd like more information on constructing your own querystrings, look at this other question: How to build query string with Javascript
-
Many Thanks. It helped me to visualize what is happening at back. Is there any theory behind this, Like, values are visible in URL for usual GET methods, but not in the case for Ajax GET methods? – Yeasin Abedin Sep 14 '13 at 04:38
-
I think you are confusing the term "URL" with "Address Bar". Do you mean you are not able to see the url change in the browser when a GET request is made? Think of it like an image. When an image loads, it does a GET request to retrieve the image. The same thing is happening for an ajax request. Instead of an image, we are receiving text. The browser's address bar is not updated when you get an image. – 000 Sep 14 '13 at 04:40
-
Yeah, I was confusing the terms "URL" with "Address Bar". In usual GET method, the query string is visible on Address Bar but not visible for AJAX GET. Why this is happening? – Yeasin Abedin Sep 14 '13 at 05:13