Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用:eq()选择器时缺少字符串_Javascript_Php_Jquery_String - Fatal编程技术网

Javascript 使用:eq()选择器时缺少字符串

Javascript 使用:eq()选择器时缺少字符串,javascript,php,jquery,string,Javascript,Php,Jquery,String,我使用jQuery从中读取字符串并将其传递到PHP中,然后插入/编辑数据库。 我的问题是,在这个过程中,我丢失了大字符串,它们永远不会保存到数据库中,我无法编辑它们!我有一个大字符串,我不能编辑它。代码崩溃了 对字符串大小有:eq()选择器限制 我选择字符串的代码是: $(document).on("click",".edit_button",function() { $(this).parents("tr").each(function(index) { $("*").c

我使用jQuery从中读取字符串并将其传递到PHP中,然后插入/编辑数据库。 我的问题是,在这个过程中,我丢失了大字符串,它们永远不会保存到数据库中,我无法编辑它们!我有一个大字符串,我不能编辑它。代码崩溃了

对字符串大小有:eq()选择器限制

我选择字符串的代码是:

 $(document).on("click",".edit_button",function() {
     $(this).parents("tr").each(function(index) {
     $("*").css("cursor", "wait");
         id = $(this).find("td").eq(0).text();
         comment = $(this).find("td").eq(1).text();
            $.ajax({
            type: 'GET',
            url: 'ajax.php',
            data:{ comment : comment , job : "edit"},
            dataType:"html",success:function(result){   
                $("*").css("cursor","auto"); 
                $(".edit_button").css("cursor", "pointer");  
                    document.getElementById("items_body").innerHTML=result;             
                }
        });

    }); 
}); 
文件ajax.PHP中的PHP代码是:

$job=$_GET["job"];
if ($job=="edit")
{
    $comment=$_GET["comment"];
    $id=$_GET["id"];
    $sql_command="UPDATE items SET comment='$comment' WHERE id='$id'";
    mysql_query($sql_command,$con);
}

您没有在ajax调用中传递
id

data:{ comment : comment , job : "edit", id : id },
eq()
没有限制,限制是get方法。所以最好使用post


尝试使用post方法发送请求。Get方法在发送数据时有一些限制。