Embed Code - jquery load/ajax

I tried a couple of methods (load & ajax) to automatically load a div when the page displays.  The embedded code fails, but no error/info is returned.  Anyone using something similar that works?  I found a post that said to conver $ to jQuery.  I tried but it still fails.

Sample Code:

// start of embedded code block

<div id="div1"></div>

<div id="div2"></div>

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

// method #1 using load

<script>

    jQuery('#div1').load('http://idx.trianglemls.com/index.php?OfficeList=72899&action=select&query_id=7&unique_frame_link=062...', function( response, status, xhr ) {

  if ( status == "error" ) {

    var msg = "Sorry but there was an error: ";

    jQuery( "#div1" ).html( msg + xhr.status + " " + xhr.statusText );

  }

});

</script>

<script>

        jQuery( document ).ready(function(){

            jQuery.ajax({

                url: 'http://www.mls.com',

                type: 'get',

                success: function(data){

                    jQuery('#div2').html(data);

                },

                error: function (xhr, ajaxOptions, thrownError) {

                    var errorMsg = 'Ajax request failed: ' + xhr.responseText + '   err: ' + thrownError;

                    jQuery('#div2').html(errorMsg);

                  }

            });

        });

        </script>

// end of embedded code block

Tags (1)
2,260 Views
Message 1 of 4
Report
3 REPLIES 3

This is the displayed page

Welcome

 
Sorry but there was an error: 0 error
Ajax request failed: thrownError:
Tags (1)
2,258 Views
Message 5 of 4
Report

I see the following in the developer tools console.

(index):1 Failed to load http://www.mls.com/index.html: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://194782851553015830.weebly.com' is therefore not allowed access.

2,229 Views
Message 5 of 4
Report

1,248 Views
Message 5 of 4
Report
This thread has been archived and locked. Please start a new thread if you would like to continue the conversation.