Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested ajax calls #13

Closed
siva1117 opened this issue Mar 27, 2013 · 6 comments
Closed

Nested ajax calls #13

siva1117 opened this issue Mar 27, 2013 · 6 comments

Comments

@siva1117
Copy link

Hi,

The links inside the ajax loaded content is not working. I'm trying to achieve a sub navigation style,

For example lets say in your demo I have clicked on the about link and loaded new content for about page and replaced the content of the '#main_content" div.

The newly loaded content has some links in itself sort of sub links (like sublink1, sublink2, etc) and a new div called "#sub_content".

Now when the sublink1 is clicked i would like to replace the content of "#sub_content" div alone without ever disturbing the '#main_content" div.

I thought of using jquery live() or on method for the click event but i cannot, since you have written ajax call in the jquery address change() function itself.

Any help or tips would be great!, BTW this is a stunning frame work.

--Subramanian

@laukstein
Copy link
Owner

Subramanian, thanks for posting the issue!
Since the issue is related to jQuery Address plugin, it would be great if @asual would participate too.

Issue summary: .address() event is not fired to Ajax loaded content.

@siva1117
Copy link
Author

Hi laukstein,

Sorry to ask you again but did you figure anything it seems to me that jQuery address won't bind on ajax-loaded content. I have posted an issue at jquery address and had no reply, so I was thinking of using history.js have you ever used history.js do u recommend it? Iam new to this whole ajax stuffs.

@laukstein
Copy link
Owner

This issue is related to jQuery Address plugin and open also in asual/jquery-address#171
I am not sure if History.js https://github.com/browserstate/history.js is SEO friendly at all.

@siva1117
Copy link
Author

Hi thanks for the reply,

I was just playing with jquery address JS file and changed the line on 588
this.on('click', function(e) {
to
this.live('click', function(e) {

Now it seems to work, but I'm sure the .live() method has been deprecated since jQuery 1.7 and has been removed in 1.9 and the suggested replacement is .on method

Very strange it works with .live() method and not with .on() method

Anyway it seems we have to wait for @asual.

Update: I used jquery-1.9.1 with jquery-migrate-1.1.1

@laukstein
Copy link
Owner

$(document).on('click', this, function(e) { is equal to this.live('click', function(e) { and has jQuery 1.9.1 compatibility, but unfortunately does not work with jQuery Address plugin.

laukstein added a commit that referenced this issue May 15, 2013
Bind jQuery Address also for Ajax loaded content issue #13
Removed outdated buggy .tracker() method (must track after Ajax success)
@laukstein
Copy link
Owner

I just pushed some updates for jQuery Address and also an demo for your case. Now your issue must be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants