开发者

store id and transfer to another php page

开发者 https://www.devze.com 2023-04-10 02:09 出处:网络
I have a little question. On my site i use for few jquery functions , they get some data and transfer by GET method to php helper. This is not work when i want to use the data in another php page. For

I have a little question. On my site i use for few jquery functions , they get some data and transfer by GET method to php helper. This is not work when i want to use the data in another php page. For exampl开发者_如何转开发e i have jquery that store id of the anchor:

$("#rightContent .users_list li a").live('click', function() {

   var id = $(this).attr('id');

   $.get("getHelper",{'userId':id},function(data){

   $('#user_rightContent').html(data);
   });
});

And in php file returned by "getHelper" i do:

if(isset($_GET['userId'])){

    $id = $_GET['userId'];
        //do something  
);

The anchor of the live click lead to another page displayed by another php file where i want to use this id by using helper... This is work only if i stay on same page... Can anybody help me in this problem? thanks for advice


add return false at the end of live('click'....

live('click', function()
{
    // code ...
    return false;
}

or do that

live('click', function(e)
{
    // code ...
    e.preventDefault();
}


You're missing the extension on the filename.

Try it with:

$("#rightContent .users_list li a").live('click', function() {

   var id = $(this).attr('id');

   $.get("getHelper.php",{'userId':id},function(data){

   $('#user_rightContent').html(data);
   });
});
0

精彩评论

暂无评论...
验证码 换一张
取 消