1

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?

2
  • You can - it's in the query string. Commented 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. Commented Sep 14, 2013 at 3:57

2 Answers 2

3

AJAX call is not visible through url.

Try to use firebug extension of firefox.

In firebug, you will find all request in console.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank You for the information. My question is, WHY "AJAX call is not visible through url" ?
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.
1

When you fire off your ajax request like this:

enter image description here

The Chrome network tab will show new line for this transaction:

enter image description here

If you click on it, it will show you all the details:

enter image description here

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

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?
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.
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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.