0

i know there are a lot of questions on this subject, but i can't seem to get my load function to work, even with all those answers out there.

I would appreciate it very much if someone could help me!

The idea is to load the #minibox div from the given URL into a div with the ID of #dophtml

the links have this form: http://dop.derbigum.com/index.php?page=&fol=/V1111_VAEPLAN%20V-FR/DE

then i like to add the value &showtemplate=false to the link to reduce the server load (i only need the bare minimum HTML), so i prevent the default click action add the "&showtemplate=false" part. next i also add the div i want .load() to filter out #minibox and i call the .load function to wrap it up.

I tried 2 methods:

$(document).ready(function () {
    $('#modalmydop a').on("click", function (event) {
        event.preventDefault();
        var posturl = $(this).attr("href") + "&showtemplate=false" + " #minibox";
        $('#dophtml').load(posturl);
    });
});

and

$(document).ready(function () {
    $('#modalmydop a').on("click", function (event) {
        event.preventDefault();
        var posturl = $(this).attr("href") + "&showtemplate=false" + " #minibox";
        $.load(posturl, function(data){
            $('#dophtml').html(data);
        });
    });
});

Both methodes don't do anything. i fiddled around https://jsfiddle.net/rezium/oztj1313/22/ but i'm getting nowhere.

is .load() not the right api for the job? or does my link contains conflicting elements?

Pete
  • 57,112
  • 28
  • 117
  • 166
Harmovitz
  • 43
  • 4
  • 1
    Your code looks fine. Have you checked the console for errors? – Rory McCrossan May 13 '15 at 14:23
  • ```Mixed Content: The page at 'https://fiddle.jshell.net/rezium/oztj1313/show/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://dop.derbigum.com/index.php?page=&fol=/V1105_VAEPLAN%20ABS/DE&showtemplate=false'. This request has been blocked; the content must be served over HTTPS.``` – evolutionxbox May 13 '15 at 14:23
  • I get the above error in the dev console. – evolutionxbox May 13 '15 at 14:23
  • Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; **the request can not successfully retrieve data from a different domain, subdomain, port, or protocol** - From the load api. Jquery api - [link](https://api.jquery.com/load/) WIkipedia - [link](http://en.wikipedia.org/wiki/Same_origin_policy) – GeorgeKaf May 13 '15 at 14:24
  • 1
    Have tried this code having both the jquery script and the target page under the same domain ? Maybe in a local installation ? – GeorgeKaf May 13 '15 at 14:33
  • this is the page i intend to use it on: http://vaeplan.com/download/dokumente#dop – Harmovitz May 13 '15 at 14:40
  • Use of getPreventDefault() is deprecated. Use defaultPrevented instead. jquery.js:5375:0 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://dop.derbigum.com/index.php?page=&fol=/V1111_VAEPLAN%20V-FR/DE&showtemplate=false. (Reason: CORS header 'Access-Control-Allow-Origin' missing). – Harmovitz May 13 '15 at 14:41

0 Answers0