jQuery.load()가로드 할 내용의 태그를 처리하는 방법에 대한 많은 질문을 본 후 jQuery가 인라인 태그를 제거한다는 것을 알게되었습니다. 하지만, 내 사이트의 연락처 페이지에 Kontactr을 사용하고 싶습니다. 그리고 아래 코드 예제와 같이 두 가지 스크립트 태그를 사용하면 Ajax가 포함 된 훨씬 더 멋진 AJAX 임베드를 만들 수 있습니다. 이 스크립트 태그를 jQuery.load (file, callback()) callback() 함수에서 실행하도록 jQuery.load() 제약 조건을 해결하려면 어떻게해야합니까?AJAX Kontactr 형식의 jQuery.load()
index.html을
<html>
<head>
<!--include css, jquery, scripts -->
<script type="text/javascript">
$(document).ready(function() {
$('#main_content').load('contact.html #main_content', function(){
//what can I put here to run the Kontactr inline script code
//when contact.html is loaded?
});
});
</script>
</head>
<body>
<div id="main_content"><!--content will load here--></div>
</body>
</html>
contact.html
내가 contact.html에<div id="contact_form"/>
을 넣을 수 있습니다 그리고 아마 스크립트 태그는 평가 후면 어쩌면 생각했습니다
<div id="main_content">
<h1>Please Contact Us With The Form Below</h1>
<!-- jQuery.load will strip out these script tags
and the form will not be embedded. -->
<script type="text/javascript"> id = 1; </script>
<script type="text/javascript" src="http://kontactr.com/wp.js"></script>
</div>
$('#contact_form').html(//eval script tags result here);
의 콜백 함수가 있지만 구문을 어떻게 처리해야할지 모르겠다.