Click here to Skip to main content
13,149,756 members (67,564 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have generated a website:


I am looking to extract var1 and var2 with an Ajax and jQuery program using the GET method.

I am using jQuery:

<script src="~/Scripts/jquery-1.4.1.js" type="text/javascript"></script>

I got a part of a Program;

<script language="javascript" type="text/javascript">
    $(document).ready(function() {
            cache: false,
            dataType: "html",
            error: function(xhr, status, error) {
                alert('An error occurred: ' + error);
            timeout: 30000,
            type: "GET",
            beforeSend: function() {
                console.log('In Ajax beforeSend function');
            complete: function() {
                console.log('In Ajax complete function');
        //I want to extract var1 and var2 into textboxes

Any help would be appreciated.
Posted 21-Feb-13 6:53am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

No, your var1 and var2 and their values are not part of HTTP request data, they are the part of request URI itself. So, take the current URI window.location and extract the parameters.


You will find enough code samples doing it, such as:[^],[^].


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100