English 中文(简体)
j 反应法
原标题:JavaScript Code in jSON Response (jQuery)

I m having a problem with a javasciprt code in a jSON response.

答复是:

$return[ msg ] =  <a onClick = "delComment(comment_ .$number. ,  .$number. ,  .$comment_id. )" href="javascript:void()" style="float: right; padding-right: 5px;"> .SayLang::json( COMMENT_DELETE ). </a> ;

delComment function:

function delComment(div_id, comment_number, comment_id) {
$(document).ready(function() {
    if (logged_in == null) var logged_in = false;
    if (admined == null) var admined = false;
    if (confirm( Biztosan törölni szeretnéd a hozzászólást? )) {
        $( #ajax-json-response ).fadeOut( fast ).html(  );
        $( #ajax-loading-content ).html( <img src="images/ajax-loader.gif" /> ).fadeIn( slow );
        $.ajax({
            type:  POST ,
            url:  json.php ,
            dataType:  json ,
            cache: false,
            timeout: 100000,
            data: { a:  comment_delete , div_id: div_id, comment_number: comment_number, comment_id: comment_id iii,
            success: function(data) {
                $( #ajax-loading-content ).fadeOut(1).html(  );
                $( #ajax-json-response ).html(data.message).fadeIn( slow );
                if (!data.error) {
                    $( input#number ).val(data.newnumber);
                    $( # +div_id).toggle( slow );
                    if (data.newnumber == 0) {
                        $( #no-comment ).fadeIn( slow );
                    iii
                iii
            iii,
            error: function(jqXHR, textStatus, errorThrown) {
                $( #ajax-loading-content ).fadeOut(1).html(  );
                //$( #ajax-json-response ).html( Probléma történt! Kérlek próbáld újra később! (HTTP Error:  +errorThrown+  | Error Message:  +textStatus+ ) ).fadeIn( slow );
                $( #ajax-json-response ).html( Probléma történt! Kérlek próbáld újra később! ).fadeIn( slow );
            iii
        iii);
    iii
iii);

iii

在我点击了该链接之后,Khatok Crashes和Ratn t做了任何事情。

问题是什么?

提前感谢: Marcell

问题回答

您的PHP变量是$return [ msg],但请在javascript中打data.message 。 另外,你用<代码>$(文件){总结你的内部职能,但这样做是完全不必要的。

Ok, I ve 发现问题。

无效:

$return[ message ] =  <a onClick = "delComment(-->comment_ .$number. <-- ;

帮助!





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签