Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2005
    Posts
    93
    Thanks
    4
    Thanked 0 Times in 0 Posts

    jqm plugin: use variable for ajax call issue

    Hi,

    Please consider the code below.

    If remove the quotes around the url var (otherwise it was passed as a string). If I alert() it the url var when onHide is triggered, the expected url is
    displayed in the alret box. If I type the full url, between single quotes, in the ajax parameter of jqm, everything's fine. If I use my url var for the ajax call... it fails.

    Code:
    var url;
      $('a.edit').livequery('click',function(){
      url = $(this).attr('href');
      return false;
    });
    
    $('#modal-test').jqm({
      ajax: url,
      onHide: function(h) {
        url= url + 'session/close/';
        $.get(url);
        h.o.remove(); // remove overlay
        h.w.fadeOut(1); // hide window
      },
    });
    
    $('a.edit').livequery('click',function(){
      $('#modal-test').jqmShow();
      return false;
    });
    Can someone tell me how to use the url var with the ajax parameter?

    Thanks in advance.

    Regards,

    -jj.

  • #2
    New Coder
    Join Date
    Feb 2009
    Location
    Uzbekistan
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Most probably url is undefined!

    You should probably combine those two click events into the one:

    Code:
    $('a.edit').livequery('click',function(){
      url = $(this).attr('href');
      $('#modal-test').jqmShow();
      return false;
    });


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •