我想在我的json输出中放置一个js window.location,以使用该javascript代码更新DIV以重定向用户。这里唯一的问题是,我的脚本在尝试将json输出中的javascript之后再也不做任何事了。JavaScript中的window.location由json返回的php
$result = array("error" => false, "html" => null);
$result["error"] = false;
$result["html"] = "<h3>Deel 1 is afgerond, <a href='/shop/?,69'>KLIK HIER</a> om door te gaan naar de begin pagina.</h3>";
$result["html"] .= "<script type="text/javascript"><!-- function Redirect() { window.location="http://www.newlocation.com"; } setTimeout('Redirect()', 10000); //--></script>";
} else {
$result["error"] = true;
$result["html"] = "<h3>Error; Neem contact op met de webmaster</h3>";
}
现在脚本因为这个JS而没有做任何事情而死亡。
我只是不知道如何格式化它。我试图改变“到”并把\放在\“之前”,但它们都不起作用。有人吗?
谢谢。
谢谢!也会使用这个js的改变! – Justin 2014-12-04 11:33:20