2010-11-25 4 views
0

Wordpress 패치를 작성 중입니다. wp-ajax-response.dev.js워드 프레스에서이 jQuery 코드에 문제가 있습니다.

문제는 다음과 같습니다 : jQuery('wp_error', child).each().size() 항상 심지어 <wp_error> 태그가 위의 XML에 대해 0을 반환

은 XML이

<?xml version='1.0' standalone='yes'?><wp_ajax><response action='autosave_1'><wp_error id='1' position='1'><response_data><![CDATA[<p> 
<h1>Error establishing a database connection</h1> 
<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>localhost</code>. This could mean your host's database server is down.</p> 
<ul> 
    <li>Are you sure you have the correct username and password?</li> 
    <li>Are you sure that you have typed the correct hostname?</li> 
    <li>Are you sure that the database server is running?</li> 
</ul> 
<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p> 
</p>]]></response_data><supplemental></supplemental></wp_error></response></wp_ajax> 

그리고 위의 XML을 구문 분석하는 스크립트입니다 것입니다 .

왜 이런 일이 발생합니까?

답변

0

아마도 이것을 시도해야합니다 jQuery('wp_error', child).each(function(){return this.size()});. 여전히 0을 반환하고 선택자에 문제가있는 경우이 경우 wp_error 요소에 child이 포함되어 있으므로 child이 가리키는 부분 (DOM이 가리키는 부분)을 더 확인해야합니다.

관련 문제