CasperJS don'我没有请求AJAX
CasperJS don't make my AJAX request
我有一个CasperJS错误。我正试图点击一个链接,那里有一个关于onclick的AJAX请求。AJAX请求从未发出。
这是我的index.php页面:
<html>
<head>
<title>AJAX test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js>
</script>
<script>
function test(id){
$.ajax({
type: 'POST',
data: {
'id': id
},
url: 'test.php',
async: false
});
alert('OK');
return true;
}
</script>
</head>
<body>
<a onclick="return test(1)" href="http://www.google.fr">www.google.fr</a>
</body>
</html>
我的测试.php页面:
<?php
print_r($_POST['id']);
mail('mymail', 'Test AJAX', $_SERVER['REMOTE_ADDR'].' : '.$_POST['id']);
?>
还有我的CasperJS脚本:
var utils = require('utils');
var casper = require('casper').create({
verbose: true,
logLevel: "debug"
});
casper.start('http://www.example.com/index.php');
casper.thenEvaluate(function(term) {}, 'CasperJS');
casper.then(function() {
this.click('a');
});
casper.then(function() {
console.log('clicked ok, new location is ' + this.getCurrentUrl());
});
casper.run();
"alert"消息启动得很好,但AJAX请求没有启动。你知道为什么吗?
我直接将代理配置为允许所有来自我的IP的连接,而无需身份验证,并且它可以工作。
相关文章:
- ajax请求的顺序总是不同的
- 从ajax请求中获取javascript对象
- Ajax请求文档就绪会导致jquery加载缓慢
- MockJax没有在JavaScript应用程序中发送对我AJAX请求的响应
- 正在传递JSONP标头's数据参数到另一个文件中的AJAX请求
- JavaScript代码未正确检查ajax请求
- node.js请求数据事件未在CORS ajax调用中触发
- jQuery Ajax GET请求工作不正常
- "日期“;AJAX请求返回的类型值未定义
- Django - 响应请求 AJAX
- 使用 jQuery 的 CORS 请求 - $.ajax()
- 如果无线电值为 ==1,则请求 ajax
- 如何处理对循环中发出的多个异步请求(AJAX 调用)的响应
- POST请求ajax jquery错误
- CasperJS don'我没有请求AJAX
- 使用这种Facebook风格的Lightbox-请求AJAX-在一个页面上覆盖多个按钮
- 400错误请求ajax post请求
- 如何在开始发送请求ajax之前延迟3秒
- 与jQuery同时请求AJAX
- 使用POST请求AJAX发送json对象