0

Query string :

Pages/Service.aspx?id=4&comment=1

I am new to jquery ,Kindly help me out with a simple solution to get the Id and COMMENT in "var id & var comment" using jQUERY in asp.net C#

1
  • What does jQuery have to do with parsing strings? Commented May 3, 2013 at 19:58

1 Answer 1

2

Use following code

<script>
    function getQuery(key){
        var temp = location.search.match(new RegExp(key + "=(.*?)($|\&)", "i"));
        if(!temp) return.
        return temp[1];
    }

    var id = getQuery('id');
    var comment = getQuery('comment');

</script>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.