weixin_33698043 2014-05-09 12:11 采纳率: 0%
浏览 6

Ajax和动态网址

I have been following a tutorial on javascript and php and modifying it to my own personal tastes. I've run into something i dont know how to fix, and i cant find anything online to help me fix it either.

The tutorial in question has shown me how to create and ajax module i can call from any php script to do its bidding. however the tutorial simply had the ordinary file paths of "index.php" or "signup.php", but i went ahead and out of my own personal preference, i used $_GET includes to display my pages via "index.php?page=signup"

the tutorial ajax module is:

function ajaxObj( meth, url ) {
    var x = new XMLHttpRequest();
    x.open( meth, url, true );
    x.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    return x;
}
function ajaxReturn(x){
    if(x.readyState == 4 && x.status == 200){
        return true;    
    }
}

now when i use a form to call this function to send data to php, it just sends me back to index.php without the dynamic url in place. im not sure what i need to place into the function call. the tutorial had:

var ajax = ajaxObj("POST", "signup.php");

I just dont know what to use besides "signup.php in the case of having the url being index.php?page=signup but nothing i've tried seems to work, and im starting to question if the error actually has anything to do with the ajax function.

Please assist a nooby noob in this dilemma.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 手机应用的时间可以修改吗
    • ¥15 docker 运行OPEN-webui异常
    • ¥15 麒麟系统如何删除光盘刻录痕迹
    • ¥15 recipe通过gem协议传的是什么
    • ¥15 TS2307: Cannot find module 'cc'.
    • ¥15 100小时学会sap 书上pp章节5.22,标准成本计算逻辑?
    • ¥50 达梦数据库误删日志文件重做DAMENG01.log启动仍然-712错误
    • ¥15 cellranger化学处理类型报错
    • ¥15 用texstudio插入图片出现下面情况,怎么办
    • ¥15 ubantu 用samba挂载windows的共享文件夹,无法挂载二级目录和修改文件