0
내가 대화 형 웹 사이트를 개발하기 위해 노력하고있어를로드 한 후 트리거되지와 나는 파일이 내가 머리 페이지에 다음 코드가 executed.So 추가해야 할 시점에 붙어있어 :자바 스크립트 코드는
$(document).ready(function(){
$('.info').live("click",function()
{
if ($('#country span.selected').text().length == 0)
alert("A company should be selected before continue!");
else {
$('.centered').hide();
$('.waitimg').show();
$.post('get_data.php',
{
type :$(this).attr("id"),
company : $('#country span.selected').text(),
company_id : $('#country').attr("value"),
country : $('#scountry span.selected').text(),
industry: $('#industry span.selected').text()
}, function(response)
{
//$('#resultarea').fadeOut();
setTimeout("finishAjax('resultarea','"+escape(response)+"')", 400);
}
);
}
return false;
});
});
을
및 콜백 : 그것은 JS/script.js에서 스크립트를 실행해야하지만 그렇지 않은
function finishAjax(id, response) {
$('#waitimg').hide();
$.getScript("js/script.js");
$('#'+id).html(unescape(response));
$('#'+id).fadeIn();
}
. Firebug를 사용하면 파일이로드되었지만 script.js의 간단한 경고 ("hello world")가 실행되지 않음을 알 수 있습니다. 왜?
시도 완료됩니다. –
@StackOverfolow : 나는 정신병자가 아니므로 귀하의 페이지가 어떤 모양인지 또는 다른 코드가 문제를 일으킬 수 있는지 알 수 없습니다. [바이올린을 설정해보십시오.] (http://jsfiddle.net) 우리가 여러분이 시도한 것을 볼 수 있도록 –
응답이 괜찮습니다. 내 문제는 script.js의 코드가 전혀 실행되지 않는다는 것입니다. –