2012-01-10 2 views
-2

아래 스크립트에서 stateId 값이 컨트롤러로 전달되지 않습니다. 어느 누구도 이걸 도와 줄 수 있습니까?stateid 값이 컨트롤러에 전달되지 않습니다.

$("#ddlState").bind("change",function() { 
    var stateId = $(this).val(); 
    $("#div_city_wrapper").load("page/new_city", {"stateId": stateId}, function(r) { 
     alert('done loading'); 
    }); 
}); 
+1

컨트롤러 표시? 당신의 모범은 아주 모호합니다. – tpae

+1

여기에 정보를 추가해야합니다. 그렇지 않으면 질문이 닫힐 수 있습니다. –

답변

0

는 자바 스크립트에 옆에 주석으로 추가 alert를 추가

$("#ddlState").bind("change",function() 
{ 
    var stateId = $(this).val(); 

    alert(stateId); // if this isn't null or undefined, then the problem is in your controller 

    $("#div_city_wrapper").load("page/new_city", {"stateId": stateId}, function(r) { 
     alert('done loading'); 
    }); 
}); 

문제가 컨트롤러에있는 경우에, 당신은, 예를 들어 매개 변수로 추가해야

function new_city($stateId = NULL) 
{ 
    if ($stateId === NULL) 
    { 
     // nothing was passed to the controller, so redirect somewhere or display an error 
    } 

    // the rest of your function... 
} 
관련 문제