dqhgjay5753 2014-04-15 12:52
浏览 307
已采纳

如何手动将POST数据输入浏览器

I'm debugging my php script and need to try to post data to by manually inputting it into the URL in my browser.

The javascript which sends the request is below. How do I enter the correct data into my browser so it's encoded in the same way as the javascript function? I tried encoding the string with http://meyerweb.com/eric/tools/dencoder/ and putting sendmail.php?q="the encoded string"... but that didn't work. Do I have to add more information?

function SendPHP(str, callback){
    xmlhttp = new XMLHttpRequest();  
    str = "q=" + encodeURIComponent(str);

    xmlhttp.open("POST","sendmail.php", true);
    xmlhttp.onreadystatechange=function(){
        if (xmlhttp.readyState == 4){
                      inProgress=false;
            if(xmlhttp.status == 200){
                            callback(xmlhttp.responseText);
            }
        }
    };
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
        if (inProgress==false){
        inProgress=true;
        xmlhttp.send(str);
        }
        else{
            writeDisplayConsole("ERROR: xmlhttp fired twice!");
        }
}
  • 写回答

2条回答 默认 最新

  • dshxbrzgi090608692 2014-04-15 12:58
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。