jquery - ajax GET request does not show params in the URL -


I am trying to request a GET on a form using the jQuery AJAX function, but the problem is that I In the URL:

Here is the code:

  & lt; Form id = "search_form" method = "get" action = "" & gt; & Lt; Input id = "seach_input" type = "text" name = "q" & gt; & Lt; Button id = "search_btn" class = "btn btn-warning" type = "submit" & gt; Search & lt; / Button & gt; & Lt; / Form & gt;  

JavaScript code here:

  $ ("# search_form"). ('Submit', function (e) {$ .ajax ({Url: "index.html", type: "GET", data: {name: "hello"}, success: function () {console. Log ("success";}}); e.preventDefault ();});  

After submitting, I want to look at the URL like this:

  http: //localhost/search.html? Q = value  

I know e.preventDefault (); This is the reason that the parameter does not appear in the URL, but I

Thank you!

Thank you.

Div clas S = "post-text" itemprop = "text">

What you want, modern browsers such as Chrome, Safari, FF4 + and IE10 can be used through the window. History. Pushstate. / P>

There is a good article here

You will need to add something like this to your code.

  Wind Ow.history.pushState ("Object or string "," Title "," / new-url ");  

In addition, if you want users to be able to navigate back, instead of using the replaceState

  window.history.replaceState ("object or string", "title", "/ other-new-url");  

Comments