+1 vote
in Other by
I am using jquery ajax get.

SO when my form is submitted it then submits to a php file but the url stays the same because i am using ajax.

$('#search').submit(function() {

$.get("http://example.co.uk/ajax/post.php", $(this).serialize(),

 function(response){

     $('#content').html(response.content);

   },"json");

 return false;

});

Ok this work url will stay the same. www.example.com

ok if i remove the return false so i get the default functionality of the form i get the following.

www.example.com?name=test&location=wales

ok here is what i am looking for i want to use ajax but still have the params appended to the title reason for this is i want my url to be shared with others so it will pull down the params from it.

example

www.example.com // will just so the basic page

but

www.example.com?name=test&location=wales // will show the page specific to wales

Any help please???

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You’d probably need to use the hash (.com/#) in order for this to happen as you can’t just edit the URL.

Ben Alman’s jQuery hashchange event plugin is probably a good start. It allow you to detect when it changes.

This tutorial may also help: Enabling the Back Button by jQuery for Designers.
...