Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.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
Php 在X-Editable中通过Ajax提交数据_Php_Jquery_Html_Ajax_X Editable - Fatal编程技术网

Php 在X-Editable中通过Ajax提交数据

Php 在X-Editable中通过Ajax提交数据,php,jquery,html,ajax,x-editable,Php,Jquery,Html,Ajax,X Editable,我试图使用Ajax提交数据,但在运行url参数中定义的php脚本时遇到问题。实际上,我从工作中得到了一些基本的例子: Html: <a href="#" id="username" data-type="text" data-pk="1" data-name="username" data-original-title="Enter username" class="editable">superuser123</a> $('#username').editable({

我试图使用Ajax提交数据,但在运行url参数中定义的php脚本时遇到问题。实际上,我从工作中得到了一些基本的例子:

Html:

<a href="#" id="username" data-type="text" data-pk="1" data-name="username" data-original-title="Enter username" class="editable">superuser123</a>
$('#username').editable({
    url: 'post.php',
    type: 'text',
    pk: 1,
    name: 'username',
    title: 'Enter username'
});
$(document).ready(function() {
    //toggle `popup` / `inline` mode
    $.fn.editable.defaults.mode = 'inline';     

    $('.edit').click(function(e){    
        e.stopPropagation();
        var button = $(this).prev('span').attr('id');

        $('#'+button).editable('toggle',{
            url: 'post.php',
            type: 'text',
            pk: 1,
            name: button,
            title: 'Edit category'                   
        });  
    });
});
这是有效的(
post.php
被执行)。但现在我想有更多的可编辑字段,并在单击按钮时运行它们。这是我的html(我正在使用Smarty):


问题是,这会创建可编辑字段,但它不会调用
post.php
script(与第一个示例不同)。我做错了什么?

我通过以下操作解决了这个问题:

$('#' + button).editable({
    url: 'post.php',
    type: 'text',
    name: button,
    title: 'Edit category',
    ajaxOptions: {
        type: 'post'
    },
    //  success: function(data) {
    //   alert(data);
    // }, 
});

谢谢你发布这个。它真的帮助了我。乔治·艾瓦兹
$('#' + button).editable({
    url: 'post.php',
    type: 'text',
    name: button,
    title: 'Edit category',
    ajaxOptions: {
        type: 'post'
    },
    //  success: function(data) {
    //   alert(data);
    // }, 
});