jQueryAjax链接,返回的数据包括一个不会提交的

jQueryAjax链接,返回的数据包括一个不会提交的,jquery,html,ajax,forms,Jquery,Html,Ajax,Forms,我对ajax请求返回的数据有问题。基本上,当我点击一个链接时,它运行一个ajax请求,将一些html加载到div中,这部分工作正常。当数据加载后,问题就出现了 加载的html的一部分是表单,如果我直接加载页面,这个表单可以正常工作,但是当它通过ajax加载到div中时,它不会提交,但是html中的其余链接可以正常工作 以下是请求远程html数据的代码: // Ajax to load image editing page $('a.editpicture').click(function(e)

我对ajax请求返回的数据有问题。基本上,当我点击一个链接时,它运行一个ajax请求,将一些html加载到div中,这部分工作正常。当数据加载后,问题就出现了

加载的html的一部分是表单,如果我直接加载页面,这个表单可以正常工作,但是当它通过ajax加载到div中时,它不会提交,但是html中的其余链接可以正常工作

以下是请求远程html数据的代码:

// Ajax to load image editing page
$('a.editpicture').click(function(e) {
    e.preventDefault();
    var picture = $(this).attr("id")

    $.ajax({
        url: 'http://localhost/digital-xposure/index.php/members/viewpicture/' + picture,
        success: function(data) {
            $('#update-picture').html(data);
        }
    });
});
这是它加载的表单:

<form method="post" id="updatepicture" name="updatepicture" action="http://localhost/digital-xposure/index.php/members/editpicture"/>

        <p>Title<input type="text" name="title" id="title" style="input" value="<?php echo $title; ?>"></P>
        <p>Album<?php echo $albums;?></p>
        <p>Description<textarea name="description" id="description" cols="50" rows="5"><?php echo $description; ?></textarea></P>
            <input type="hidden" name="filename" id="filename" value="<?php echo $filename; ?>" />
        <input type="button" name="update-submit" id="update-submit" value="Update details" class="button"> Or <input type="button" onClick="location.href='<?php echo base_url(); ?>index.php/members/deletepicture/<?php echo $filename; ?>'" value="Delete picture" class="button">

    </form>


Title而不是使用。单击语法

尝试将您的事件改写为

$('.selector').live('click', function(){....});

执行查看源代码以验证呈现的HTML是否存在


如果找不到,请检查生成的源代码(Firefox web developer插件具有此功能)以验证生成的HTML是否存在。

您的表单是自动关闭的:

<form method="post" id="updatepicture" name="updatepicture"
action="http://localhost/digital-xposure/index.php/members/editpicture"/>

请尝试以下方法:

<form method="post" id="updatepicture" name="updatepicture" 
action="http://localhost/digital-xposure/index.php/members/editpicture">

Firefox可能在正常运行时检测到它,然后在使用脚本嵌入它时检测不到它


祝你好运。

谢谢你的回复,只是尝试了一下,但还是没有提交表单。没有页面错误,请求的html中的表单就是没有提交。