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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 Matlab打开默认名称带有/的光谱数据
    • ¥50 easyExcel模板 动态单元格合并列
    • ¥15 res.rows如何取值使用
    • ¥15 在odoo17开发环境中,怎么实现库存管理系统,或独立模块设计与AGV小车对接?开发方面应如何设计和开发?请详细解释MES或WMS在与AGV小车对接时需完成的设计和开发
    • ¥15 CSP算法实现EEG特征提取,哪一步错了?
    • ¥15 游戏盾如何溯源服务器真实ip?需要30个字。后面的字是凑数的
    • ¥15 vue3前端取消收藏的不会引用collectId
    • ¥15 delphi7 HMAC_SHA256方式加密
    • ¥15 关于#qt#的问题:我想实现qcustomplot完成坐标轴
    • ¥15 下列c语言代码为何输出了多余的空格