Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners How can I get query string values in JavaScript?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Java Coder
How can I get query string values in JavaScript?
1 Answer(s)      8 months ago
Posted in : Java Beginners


How can I get query string values in JavaScript?


Advertisement
View Answers

December 27, 2013 at 5:44 PM


To get a query string value, you can use JQuery and JavaScript.. here is the code:

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}


Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com