.load ajax 기능을 위해 jquery를 사용하기 시작했습니다. 특정 div에 외부 페이지를로드하면 잘로드됩니다. 외부 페이지 안에는 자바 스크립트를 머리에 붙이는 .append가있다. 이것은 초기로드에서 작동하지만로드 할 때 .load를 사용하면이 부분이 표시되지 않습니다.Jquery .load 및 inner jquery .append
//This is the .load for the div
function loadContent(elementSelector, sourceUrl) {
url = ""+sourceUrl+"";
$(""+elementSelector+"").load(url);
alert(url);
}
//This is the append in the other page that is embedded in a js
var cUrl = "http://intensedebate.com/js/genericCommentWrapper2.php?acct="+idcomments_acct+"&postid="+idcomments_post_id+"&title="+idcomments_post_title+"&url="+idcomments_post_url;
alert(cUrl);
commentScript.type = "text/javascript";
commentScript.src = cUrl;
$('head').append(commentScript);
편집 : 경고 (cUrl)가 매번 실행됩니다. 그러나 머리는 isnt 렌더링을 추가합니다.
왜 지구에 당신이 빈 문자열을 연결하는? – SLaks
LOL 나는 interwebs에서 그 코드를 꺼냈다. – speekeazy