Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2011
    Thanked 0 Times in 0 Posts

    Exclamation can you use the .load() to call an external page?

    I have an HTML file that includes jquery.js file.. and has the following logic:

    function myfunction(tagID){
    $("#target" + tagID).load("http://externalserver/test/mysecondpage.php?tagVal=" + tagID,function(){
    $("#target2" + tagID).empty();

    Later on in the page, i have the following:

    <td><a href="#" onclick="myfunction( '1104' )"> 1104</a>
    <span id="target1104">Fill me in</span>
    <span id="target21104">"erase me"</span>

    When i click on the hyperlink, the call to mysecondpage.php is not happening.
    target2 is emptied / erased.. and the alert shows the right tagID. but the value that mysecondpage returns is not showing up. and i know that the mysecondpage.php page is not even being called because when it is, it sets a status value in my database.

    can you pass an external page to the load method? the page i'm trying to get is hosted on another server within our company...
    any suggestions would be appreciated. I'm new to ajax and not an expert in javascript either.. so if you can explain in detail, that'd be great.

    Last edited by chubbypama; 05-20-2011 at 07:04 PM.

  2. #2
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Halle (Saale), Germany
    Thanked 1,299 Times in 1,269 Posts
    I guess here comes JavaScript’s same origin policy into play.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts