2012-07-08 4 views
0

내가캐치되지 않는 예외 개체 # <objectid>가있는 방법 'HTML'

캐치되지 않는 예외 개체 #의 displayusersearch2가있는 방법 'HTML'

코드는

<script src="../../javascript/jqueryfunctions.js" type="text/javascript"></script> 
<script src="../../jquery.min.js" type="text/javascript"></script> 
<script type="text/javascript"> 
function uid_id_search_change() 
{ 
    var search=document.getElementById('uid_id_search').value; 
    $.get('userdisplaypopup.php?id='+search,userset); 
} 

function userset(res) 
{ 
    ('#displayusersearch2').html(res); 
    Uncaught TypeError: Object #displayusersearch2 has no method 'html' 
} 
</script> 

<table width="600" border="0"> 
    <tr> 
     <th scope="row"><font size="-1">Book Id</font></th> 
     <td><input type="text" value="1" id="bid_popup" /></td> 
    </tr> 
    <tr> 
     <th scope="row"><font size="-1">Book Name</font></th> 
     <td><input type="text" value="1" /></td> 
     </tr> 
     <tr> 
      <th scope="row"><font size="-1">Author</font></th> 
      <td><input type="text" value="1" /></td> 
     </tr> 
     <tr> 
      <th scope="row"><font size="-1">Publisher</font></th> 
      <td><input type="text" value="1" /></td> 
     </tr> 
     <tr> 
      <th scope="row">Search User</th> 
      <td><input type="text" id="uid_id_search" name="uid_id_search" onkeyup="uid_id_search_change();" /> 
      <div id="displayusersearch2"></div></td> 
     </tr> 
</table> 
이다가 없습니다이 메시지를 얻고이 없습니다

div의 ID는 displayusersearch2입니다. 요청이 올바르게 전송 중입니다. 나는 응답을하려고하는 것은 사업부의 displayusersearch2

답변

4
('#displayusersearch2') 

에 표시 할 당신은 jQuery를 래퍼 호출 것을 만드는 $를 생략. 그것 없이는 이것은 문자열 리터럴 이상입니다. 문자열 '#displayusersearch2'에는 html() 메서드가 없습니다. 또한

$('#displayusersearch2').html(res); 

,

$.get('userdisplaypopup.php?id='+search,userset); 

가있는 URL 특수 문자로 어떤 search 용어 실패합니다. encodeURIComponent()을 사용 하시거나 jQuery가 당신을 위해 해달라고 제안하십시오 :

$.get('userdisplaypopup.php', {id: search}, userset); 
관련 문제