Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-12-2012, 03:04 PM   PM User | #1
jarenare
New to the CF scene

 
Join Date: Jan 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
jarenare is an unknown quantity at this point
Question Load external page issue

Hi all,

I'm a bit newbie in scripting, but i'm trying to learn by myself . Hope you can help me with this

I have two main pages, called index.html and news.html. Both pages loads a third page called news_content.html, using AJAX function load.

This third page has a pagination script, but the pagination has to be different if the page has been loaded from index.html or news.html (for example, the max items per page has to be different). The pagination settings are defined inside news_content.html.

How can I know, from the content page, with one has loaded it? Or... its possible to pass values from the main pages into the content page, in order to change the pagination settings?

Thanks in advance!
jarenare is offline   Reply With Quote
Old 01-13-2012, 03:06 PM   PM User | #2
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 453 Times in 451 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
I don't know how the ajax load works, but generally the way to do this is with query strings - at the end of the url you use to open your page you add a question mark and then something unique, so coming from index it would be like:

www.mysite.news_content.html?ind

and coming from news it would be:

www.mysite.news_content.html?news

both will open the same page (the browser ignores everything after the question mark) and then you can use document.location.search to chop off what came after the question mark and turn it into a variable that tells news_content what to do.

google query strings for more info, or post some code/a link if you are having trouble.
xelawho is offline   Reply With Quote
Users who have thanked xelawho for this post:
jarenare (01-17-2012)
Old 01-17-2012, 12:13 AM   PM User | #3
jarenare
New to the CF scene

 
Join Date: Jan 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
jarenare is an unknown quantity at this point
xelawho thanks for your time! I've tried your suggestion and works!
jarenare is offline   Reply With Quote
Reply

Bookmarks

Tags
content, javascript, load, page, values

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:23 AM.


Advertisement
Log in to turn off these ads.