2012-11-07 3 views
0

JS-Jquery 파일을 찾았습니다. 확인란을 클릭하면 PHP 함수가 호출됩니다. 이제 다른 PHP 함수를 호출하는 다른 확인란을 추가하고 싶습니다.PHP 함수를 호출하는 Ajax 요청 함수, 멍청한 물건들

그래서 함수를 복사하려고했습니다. 값을 변경해도 효과가 없습니다.

나는 1-2 초 만에 실수를 보게 될 것이므로, JS-Fiddle의 짧은 모양에 감사드립니다!

나는 또한 복사, 난 그냥이 추가 깜빡

$('input[name="ive-read-this"]').change(function (evt) { 
    alert("markiere als gelesen."); 

    // We can retrieve the ID of this post from the <article>'s ID. 
    // This will be required 
    // so that we can mark that the user has read this particular post and 
    // we can hide it. 
    var sArticleId, iPostId; 

    // Get the article ID and split it - the second index is always 
    // the post ID in twentyeleven 
    sArticleId = $("article").attr('id'); 
    iPostId = parseInt(sArticleId.split('-')[1]); 

    // Initial the request to mark this this particular post as read 
    $.post(ajaxurl, {   
     action: 'mark_as_read', 
     post_id: iPostId  
    } 
+1

복사 된 코드를 게시하십시오. 어디에서 오류가 발생했습니다 .... 작동하지 않습니다 .. :) :) – bipen

+0

피들에 구문 오류를 수정하십시오. –

+0

@bipen 작동하지 않는 것은 JS-Fiddle입니다. – mnewmedia

답변

0

JS-바이올린에 내 tryings을보고 싶습니다이 부분 :

ADD_ACTION ('wp_ajax_mark_as_unread', 배열을 (& $ this, 'mark_as_unread')));

그래서 해결되었습니다! 감사합니다

관련 문제