使用ajax调用时不执行Javascript [英] Doesn't execute Javascript when called using ajax

查看:62
本文介绍了使用ajax调用时不执行Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在这里尝试的是从我的第一个文件中我正在调用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/////////////////

展开 | 选择 | Wrap | 行号

推荐答案

.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/////////////////
展开 | 选择 | Wrap | 行号


这篇关于使用ajax调用时不执行Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆