用Ajax传递的Post参数,php怎么接收不到

用Ajax传递的Post参数,php怎么接收不到,第1张

你的这个文件不是welcomephp

就改一下你的代码

----------------------------------------

好吧我就再改一下代码吧;

indexhtm

<form name = "name1" action="testphp" method="post">

Enter your name: <input type="text" name="name" />

Enter your age: <input type="text" name="age" />

<input type="submit" />

</form>

testphp

Welcome <php echo $_POST["name"]; ><br />

You are <php echo $_POST["age"]; > years old!

可以通过解析url路径,获取参数

function getURLParameter(name) {

return decodeURIComponent((new RegExp('[|&]' + name + '=' + '([^&;]+)(&|#|;|$)')exec(locationsearch)||[,""])[1]replace(/\+/g, '%20'))||null;

}

var orgid = getURLParameter('orgid');

var orglevel = getURLParameter('orglevel');

consolelog('orgid='+orgid);

consolelog('orglevel='+orglevel);

扩展资料

html中通过url地址传参及获取参数:

var url = documentlocationtoString();//获取url地址

var urlParmStr = urlslice(urlindexOf('')+1);//获取问号后所有的字符串

var arr = urlParmStrsplit('&');//通过&符号将字符串分割转成数组

var courseId = arr[0]split("=")[1];//获取数组中第一个参数

var unit_title=arr[1]split("=")[1];//第二个参数

unit_title=decodeURI(unit_title);//转码将解码方式unscape换为decodeURI,将中文参数获取

consolelog(unit_title);

以上就是关于用Ajax传递的Post参数,php怎么接收不到全部的内容,包括:用Ajax传递的Post参数,php怎么接收不到、html中的js如何获取通过POST方法传递过来的参数、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/9570655.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-29
下一篇 2023-04-29

发表评论

登录后才能评论

评论列表(0条)

保存