You must Sign In to post a response.
  • Category: JQuery

    How to pass vaues using jquery

    Hi,

    I want to pass a value to another page and display value there and load that page using jquery

    i tried following code

    $('#addr').click(function (e) {
    e.preventDefault();
    var url = "AddressForm.aspx?stid=" + encodeURIComponent($("#txtstid").val()) + "&clas=" + encodeURIComponent($("#txtclass").val());
    // window.location.href = url;
    $('#displ').load(url);
    });

    here i want to display AddressForm.aspx in displ div. and passing 2 texbox values.

    i wrote the code for displaying in AddressForm.aspx

    as

    var queryString = new Array();
    if (queryString.length == 0) {
    if (window.location.search.split('?').length > 1) {
    var params = window.location.search.split('?')[1].split('&');
    for (var i = 0; i < params.length; i++) {
    var key = params[i].split('=')[0];
    var value = decodeURIComponent(params[i].split('=')[1]);
    queryString[key] = value;
    alert(value);
    }
    }
    }

    $('#astudent').val(queryString["stid"]);
    $('#aclass').val(queryString["clas"]);

    current problem is Addressform.aspx is displaying but no data is displaying in corresponding textboxes.

    How to solve this

    Regards

    Baiju
  • #763232
    Hi baiju,

    I suggested you to check whether values are getting in page2 via browser in console, if values are getting may be problem with display in page2, if values not getting problem with passing parameters in page1. Refer below link, here he is explains how to pass query sting using jquery with simple example"aspsnippets.com/Articles/Send-Pass-Data-Values-from-one-page-to-another-using-jQuery.aspx".

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


  • Sign In to post your comments