【Ajax的小封装get,post请求】教程文章相关的互联网学习教程文章

ajax获取到的id数据,如何通过post方式提交该数据到post页面去。

ajax获取到的id数据,如何通过post方式提交该数据到post页面去。 比如这样子的,如果id=“abc”里面显示的是:我们和你。。。 请问如何才能把我们和你这个值通过post方式提交给test.php处理页面去活得这个值 回复讨论(解决方案) 百度一下,ajax post请求很多的,我一般都是用jquery的ajax 很方便 $.ajax({ type: POST, url:"createurl('ctrain')?>", ca...

js里面的对象ajaxpost到php端直接变成数组了?

本帖最后由 zhoumengkang 于 2013-09-12 10:03:14 编辑 事先引入了jquery var str ="{a:b,aa:bb}";var str2 = eval((+str+));var type = typeof(str2);console.log(str);console.log(type);//objectconsole.log(str2);$.post(./bb.php,{data:str2}); bb.php的代码 $data = $_POST[data];var_dump($data); 控制台上看返回结果,直接输出为数组了 array(2) { ["a"]=> string(1) "b" ["aa"]=> string(2) "bb"} 我...

请问ajaxpost表单,php怎么接收?

a.html var params=$("#form1").serialize(); $.ajax({ type: "post", contentType: "application/text", data:params, dataType:"json", //dataType: "binary", async: false, timeout: 30000, url: '1.php', success: function(data){ //处理data数据 var s = eval(data); alert(s.a+' '+s.b); }, error: function(x, e) { ...

通过ajaxPOST传值,但返回为空

第一次接触ajax,想通过一个简单的例子来练练 index.php中有一个下拉列表,选择不同的班级返回不同的学生信息 代码如下: 查询学生信息 请选择班级: choose class "> 通过result.php查询数据库,并返回学生信息,代码如下: 学号姓名住址班级"; foreach($info as $v){ $result.="{$v['sid']}{$v['name']}{$v['address']}{$v['cid']}"; } $result.=""...

ajaxPOSTjson对象给PHP,PHP如何接收值

前端: $("#save_config_btn").click(function(){ $.ajaxSetup({ cache:false, contentType : "application/x-www-form-urlencoded; charset=utf-8" }); var fields = $("#rss_form").serializeArray(); fields = JSON.stringify(fields) //中文会乱码 $.ajax({ type: "POST", url : "edit.php", data: fields, success: functio...

PHP如何接受ajax的post表单并分行保存TXT呢

JS代码如下 function SubmitApply() { var form = Global.GetElement("#submitForm"); var UserName = Global.GetElement(form, input[name="Name"]).value; var Mobile = Global.GetElement(form, input[name="Tel"]).value; var Position = Global.GetElement(form, input[name="Position"]).value; var Company = Global.GetElement(form, input[name="Company"]).value; var ActId = Global.GetElement(f...

php中如何接收AjaxPOST数据【图】

正在加载联系人what's going on?what's going on?what's this?what's this???? 写点什么再发吧!">Ctrl+Enter 发送 /** * 发送信息/获取信息 */// 清除定时器function clearChatTimers(id){ if(id){ //请除指定用户定时执行 if(aPChatTimers[id]){ clearTimeout(aPChatTimers[id]); loadFlag = false;// console.log(clear:+aPChatTimers[id]); } }else{ //请除所有用户定时执行 for (var i=0;i0){ ...

ajaxpost数据提交PHP后台接收不到数据

JS的脚本提交 $.ajax({ url:"/music/json.php", type:"POST", data:{"id":id}, dataType:"json", success: function(e){ PHP后台: //这里不知道怎么接收数据 echo $_POST["id"]; //不行 echo json_decode($_POST[data]);//不行//下面就是数据库查询$query="select * from gequ where id=$_POST[id]";//执行查询语句不正确,尝试各种方法如上面获取ID的数据未果来求助$result=mysql_query( $query ); ...

Jqueryajaxpost提交给ThinkPHP的控制器,但是获取不到$_POST,应该怎么写呢

前端的js是这样的 var uid = 10002; var a = get_users; jQuery.ajax({ url: "http://localhost:8099/thinkphp111/index.php?s=/Index/index.html", type: "POST", data: { uid: uid, a: a }, success: function (jsonResult) { alert(jsonResult); ...

手机压缩图片通过base64上传ajax不能post

测试上传文件 body { margin: 20px 20%; color: #777; text-align: center;} <?php$base64=file_get_contents("php://input"); //获取输入流$base64=json_decode($base64,1);$data = $base64[base64];preg_match("/data:image\/(.*);base64,/",$data,$res);$ext = $res[1];if(!in_array($ext,array("jpg","jpeg","png","gif"))){ echo json_encode(array("error"=>1));die;}$file=time()...$ext;...

thinkPHPajaxpost向后台传参,后台接收不到

$.ajax({ type: 'post', url: '__APP__/Wechat/Shulte/gmtim', data: { // 这种方式提交参数 'name': result }, success: function(msg) { alert(msg); } }); ajax执行成功,抓包成功。 public function gmtim...

ajax通过post方式传参给后台controller,怎么获取传过来的参数

ajax: $.ajax({ url:'index.php?c=MapsApi&m=getLocation', type: 'post', // dataType: 'json', timeout: 3000, data:{name_province:name_province}, success: function(msg){ alert("dddd"+unescape(msg)); }, error: function(e){ alert(JSON.stringify(e)...

在ajax中用POST方法提交的XML串,服务器端怎么回显到客户端

在ajax中用POST方法提交的XML串,服务器端如何回显到客户端?符上原代码: New Document select OPtion Server response test ------解决方案--------------------客户端:下面这个函数里面应该添加接收后的处理. function show(){ if(xmlhttp.readyState==4){ if(xmlh...

小弟我用jquery的AJAX通过POST过来数据appliction/json-rpc接收不到,这是为什么?

我用jquery的AJAX通过POST过来数据 appliction/json-rpc 接收不到,这是为什么??JScript code 以上是我的代码,我用POST过来传到服务器,结果我在服务器 $_POST里获取不到这是为什么??,是不是 application/json-rpc的传输格式导致的,如果这 application/json-rpc传输格式我要怎么在后端获取POST值------解决方案--------------------PHP code $s = fopen("php://input", rb); echo fread($s, 10000); ------解决方案------...

js里边的对象ajaxpost到php端直接变成数组了

js里面的对象ajax post到php端直接变成数组了?本帖最后由 zhoumengkang 于 2013-09-12 10:03:14 编辑事先引入了jquery var str ="{a:b,aa:bb}"; var str2 = eval((+str+)); var type = typeof(str2); console.log(str); console.log(type);//object console.log(str2); $.post(./bb.php,{data:str2}); bb.php的代码 $data = $_POST[data]; var_dump($data); 控制台上看返回结果,直接输出为数组了 array(2) {["a"]=>string(1) "b"...