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?
-
You can - it's in the query string.user1864610– user18646102013-09-14 03:40:04 +00:00Commented Sep 14, 2013 at 3: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– Yeasin Abedin2013-09-14 03:57:16 +00:00Commented Sep 14, 2013 at 3:57
Add a comment
|
2 Answers
AJAX call is not visible through url.
Try to use firebug extension of firefox.
In firebug, you will find all request in console.
2 Comments
Yeasin Abedin
Thank You for the information. My question is, WHY "AJAX call is not visible through url" ?
Jasmin Mistry
AJAX 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.
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
3 Comments
Yeasin Abedin
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?
000
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.
Yeasin Abedin
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?