Hi, I have the following function running: <script type='text/javascript'> $(function(){ $("form#search-form").submit(function(){ $("#search-text").animate({"width":"229px"}); $("#results").fadeOut(); var allVars = $.getUrlVars(); var byName = $.getUrlVar('service'); $.ajax({ type:"GET", data: $(this).serialize(), url: "search.php?sp=", success: function(msg) { $("#results").html(msg); $("#results").fadeIn(); $("#search-text").html("<a href='#' id='search-again'>Search Again</a>"); } }); return false; }); $("#search-again").live("click", function() { $("#search-text").html("Search"); //$("#search-text").animate({"width":"58px"}); $("#search-text").width("58px"); $("#search-form").fadeIn(); }); }); </script> Code (markup): And on this line url: "search.php?sp=", I want to put a get value after the = symbol. The url i have is: www.mysite.com/?service=test I want want to get the value of service. I found this website here: http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html which you can get get values with jquery but am unsure on how to implement this into what i already have. Thanks in advance, Adam
The easiest way is to simply call PHP to do the work. Here: <script type='text/javascript'> $(function(){ $("form#search-form").submit(function(){ $("#search-text").animate({"width":"229px"}); $("#results").fadeOut(); var allVars = $.getUrlVars(); var byName = $.getUrlVar('service'); $.ajax({ type:"GET", data: $(this).serialize(), url: "search.php?sp=<?php echo $_GET['service']; ?>", success: function(msg) { $("#results").html(msg); $("#results").fadeIn(); $("#search-text").html("<a href='#' id='search-again'>Search Again</a>"); } }); return false; }); $("#search-again").live("click", function() { $("#search-text").html("Search"); //$("#search-text").animate({"width":"58px"}); $("#search-text").width("58px"); $("#search-form").fadeIn(); }); }); </script> Code (markup): Just remember to save it as .php if you are currently using .html.