Php 这是jquery.ajax()中的有效url参数吗?
这是jquery.ajax()中的有效url参数Php 这是jquery.ajax()中的有效url参数吗?,php,jquery,ajax,url,codeigniter,Php,Jquery,Ajax,Url,Codeigniter,这是jquery.ajax()中的有效url参数 $(文档).ready(函数(){ getRecordspage(); }); 函数getRecordspage(){ $.ajax({ 类型:“POST”, url:“http://localhost/codeigniter_cup_myth/index.php/adminController/mainAccount", 数据:“, contentType:“应用程序/json;字符集=utf-8”, 全球:错, async:false, 数
$(文档).ready(函数(){
getRecordspage();
});
函数getRecordspage(){
$.ajax({
类型:“POST”,
url:“http://localhost/codeigniter_cup_myth/index.php/adminController/mainAccount",
数据:“,
contentType:“应用程序/json;字符集=utf-8”,
全球:错,
async:false,
数据类型:“json”,
成功:函数(jsonObj){
警报(jsonobj);
}
});
}
url似乎没有进入我的控制器功能…您正在使用类似mod_rewrite I asume的功能。你应该使用一个直接的url(),我的意思是允许在你的url中使用get变量 在您的url中,仅尝试函数名
url:“main”尝试将async设置为
true
。还有,萤火虫怎么说
总是用来看看到底发生了什么
@dodo当我使用codeigniter时,我想调用一个控制器函数如何实现这一点?也许你可以创建自己的页面(例如),这个页面用类似curl的东西模拟对控制器函数的调用。。。我不熟悉codeigniter,所以我不能给您提供确切的解决方案,这是您必须自己做的;)
<script type="text/javascript">
$(document).ready(function() {
getRecordspage();
});
function getRecordspage() {
$.ajax({
type: "POST",
url: "http://localhost/codeigniter_cup_myth/index.php/adminController/mainAccount",
data: "",
contentType: "application/json; charset=utf-8",
global:false,
async: false,
dataType: "json",
success: function(jsonObj) {
alert(jsonobj);
}
});
}
</script>