Solved

jquery read post data from url in a .load on the called page.

Posted on 2012-04-05
3
346 Views
Last Modified: 2012-04-09
I am performing a

 $.('#mycontainer').load('myurl.html?id=123');

on the myurl.html when I try to read the location.href, it is showing me the index.html(parent container) url.

I need to be able to read the id param from the url on the myurl.html page to determine what I need to do as it can change based on certain things.

At the end, the question is how do I read the url param from the page that was called in?

Thanks

Judson
0
Comment
Question by:judsonmusic
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
Proculopsis earned 500 total points
Comment Utility
This will work if #mycontainer is an iframe, otherwise myurl.html will have no context of its own as it's content will just be in-line within the hosting page, as you have seen.
0
 
LVL 3

Author Comment

by:judsonmusic
Comment Utility
Thats what I was afraid of. I can do this with coldfusion or anther server language no problem but am trying to figure out a way to manipulate data without using a server side language.

I could easily grab the attribute like id=1, or id=2 and then set my url accordingly. but I want to have code blocks instead. maybe I can show hide onsuccess based on the id?
0
 
LVL 20

Expert Comment

by:Proculopsis
Comment Utility
I'm guessing the content being loaded is static but if you can change myurl.html to myurl.cfm then you will unlock all the information you need.  Or you could use some kind of proxy - loader.cfm?content=myurl.html&id=123' and get it to include the content.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now