使用ajax调用时不执行Javascript [英] Doesn't execute Javascript when called using ajax
问题描述
我在这里尝试的是从我的第一个文件中我正在调用handler.php文件
//////// ////////////////////// FirstFile //////////////////////// >
[HTML]< html>
< head>
< script src =''jquery-1.1.3.1.pack.js'' type =''text / javascript''>< / script>
< script type =''text / javascript''>
$ .post( " http://practice.dev/handler.php",
函数(数据)
{
alert(data);
//document.write(data);
$(" #test")。append(data);
$(" #test")。html(data);
});
< / script>
< / head>
< body>
< div id =''test''>
< / div>
< / body>
< / html> [/ HTML]
//////////////// ////////handler.php/////////////////
Hi,
What I am trying here is that from my first file I am making a call to handler.php file
//////////////////////////////FirstFile////////////////////////
[HTML]<html>
<head>
<script src=''jquery-1.1.3.1.pack.js'' type=''text/javascript''></script>
<script type=''text/javascript''>
$.post("http://practice.dev/handler.php",
function(data)
{
alert(data);
//document.write(data);
$("#test").append(data);
$("#test").html(data);
});
</script>
</head>
<body>
<div id=''test''>
</div>
</body>
</html>[/HTML]
////////////////////////handler.php/////////////////
推荐答案
.post(" http://practice.dev/handler.php" ;,
function(data)< br $>
{
alert(data);
//document.write(data),
.post("http://practice.dev/handler.php",
function(data)
{
alert(data);
//document.write(data);
(" #test")。append(data);
("#test").append(data);
(" #test")。html(data);
});
< / script>
< / head>
< body>
< div id =''test''>
< / div>
< / body>
< / HTML> [/ HTML]
////////////////////////handler.php//////////// /////
("#test").html(data);
});
</script>
</head>
<body>
<div id=''test''>
</div>
</body>
</html>[/HTML]
////////////////////////handler.php/////////////////
这篇关于使用ajax调用时不执行Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!