开发者

jquery address change not being triggered with different URL?

I've hit a wall. My scenario simply doesn't make sense. I'm using the jquery address pluglin

Here is my issue:

A user enters a url with an argument like so:

http://localhost/#view_profile=1

The jquery address change function sees it fine and calls the appropriate method:

$.address.change(function(e) {

var urlAux = e.value.split('=');
var page   = urlAux[0];
var arg  = urlAux[1];

alert("page: " + page);
alert("arg: " + arg);

if (page == "/view_profile") {

    $.address.title("Profile");

    $('#main').load("view_profile.php?id=" + arg, function () { 
    alert("FUNCTION CALLED");
    });
}
....

Now, here's my is开发者_如何学编程sue; a user enters a new URL like so:

http://localhost/#view_profile=2

The address change is triggered but it never gets inside my if block. If I enter the same address a second time it does trigger the code in my if block.

Is this a known issue or does it have something to do with page caching somehow?

output from first URL:

page: /view_profile
arg: 1
FUNCTION CALLED

output from second URL:

page: /view_profile
arg: 2
**** Why is the if block not being triggered? ***

output from second URL (agian):

page: /view_profile
arg: 2
FUNCTION CALLED

I'm stumped...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜