#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2016
    Posts
    21
    Rep Power
    0

    jQuery .load() with querystring return selected ID on page


    Hi

    I am new to jQuery/Ajax so there might be a really simple solution to this query.

    I have the following jQuery command which works fine on return the information from the info.html page.

    Code:
        $("#pn").blur(function(){
            $('#coding').load('info.html?pn=' + $('#pn').val());
        });
    What I want to achieve is the ability to return selected 'IDs' from the info.html page. The following code works without passing the querystring,

    Code:
        $("#pn").blur(function(){
            $('#coding').load('info.html #title');
        });
    but I really need to pass the querystring. I have tried the following and neither work

    Code:
        $("#pn").blur(function(){
            $('#coding').load('info.html?pn=' + $('#pn').val() + '#title');
        });
    or

    Code:
        $("#pn").blur(function(){
            $('#coding').load('info.html?pn= #title' + $('#pn').val());
        });
    Any help would be great.
  2. #2
  3. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,271
    Rep Power
    4193
    Code:
        $("#pn").blur(function(){
            $('#coding').load('info.html?pn=' + $('#pn').val() + '#title');
        });
    You need a space before the #title part.

    Code:
        $("#pn").blur(function(){
            $('#coding').load('info.html?pn=' + $('#pn').val() + ' #title');
        });

    Comments on this post

    • jongee agrees : Perfect
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2016
    Posts
    21
    Rep Power
    0
    Perfect.

    Thanks

IMN logo majestic logo threadwatch logo seochat tools logo