0

I am trying to load an external file that contains some html code into a div using jQuery.load, but I failed: Div:

<div id="htmhtm"></div>

jQuery:

$('#htmhtm').load(
'https://github.com/kastolom/diefororacle/blob/master/2014-08-28-pivot/html/article.html'
);

JSFiddle

Could anyone please tell me where the problem is?

I want to have my blog entries outside of the blog hosting, in order to be able to migrate from one resource to another, for example, from blogger.com to wordpress

4

1 Answer 1

2

Try

create file , save as type json, e.g., content.json

callback({"result":"<p>something that I need to add</p>"})

js

(function () {
    callback = function (data) {
        if ($(data.result).is("p")) {
            $("#htmhtm").html(data.result)
        }
    };  
    $.getJSON("https://raw.[url]/content.json?callback=?");
}());

jsfiddle http://jsfiddle.net/guest271314/wdg14r02/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.