Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.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 为什么AJAX响应中断<;表格>;标签_Php_Jquery_Html_Ajax_Forms - Fatal编程技术网

Php 为什么AJAX响应中断<;表格>;标签

Php 为什么AJAX响应中断<;表格>;标签,php,jquery,html,ajax,forms,Php,Jquery,Html,Ajax,Forms,我有两个简单的同步AJAX请求: iDialog.LoadContent(url).done( function() { content = iDialog.content; $.ajax({ method: "POST", url: iDialog.router, data: { content: content } }).done(function(res

我有两个简单的同步AJAX请求:

iDialog.LoadContent(url).done(
    function()
    {
        content = iDialog.content;

        $.ajax({
            method: "POST",
            url: iDialog.router,
            data: { content: content }
        }).done(function(response) {
            //do some stuff..
        });
    }
);
加载内容:

LoadContent: function(url)
{
    if (url === "undefined")
        return;

    return $.ajax({
        method: "POST",
        url: url,
        data: {},
        success: function(html)
        {
            iDialog.content = html;
            var iDialogEvent = new CustomEvent("iDialogContentLoaded");
            window.dispatchEvent(iDialogEvent);
        }
    });
},
ob_end_clean();
echo $_REQUEST["content"];
die();
其中
content
是一种简单的形式
response
是来自服务器的答案,它应该是相同的形式,但我收到的不是它,而是一个损坏的标签
。有趣的是,
console.log(content)
显示正确的
,这似乎是第二次查询中的问题。以前从未遇到过这个奇怪的问题

服务器端:

LoadContent: function(url)
{
    if (url === "undefined")
        return;

    return $.ajax({
        method: "POST",
        url: url,
        data: {},
        success: function(html)
        {
            iDialog.content = html;
            var iDialogEvent = new CustomEvent("iDialogContentLoaded");
            window.dispatchEvent(iDialogEvent);
        }
    });
},
ob_end_clean();
echo $_REQUEST["content"];
die();

我应该用另一种方式发送HTML标签吗?我做错了什么?

如果(url==“undefined”)返回
是一个错误,如果url未定义,它将导致错误。请检查控制台的“网络”选项卡并检查XHR。你可能在那里找到线索。另一个猜测是在
done
部分中执行
数据:{content:encodeURIComponent(content)}
if(url==“undefined”)返回
是一个错误,如果url未定义,它将导致错误。请检查控制台的“网络”选项卡并检查XHR。你可能在那里找到线索。另一个猜测是在
done
部分中执行
数据:{content:encodeURIComponent(content)}