最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
關(guān)于jquery請(qǐng)求post的信息

jquery跨域發(fā)送Post請(qǐng)求該怎么處理

$.ajax({

創(chuàng)新互聯(lián)是專業(yè)的簡陽網(wǎng)站建設(shè)公司,簡陽接單;提供網(wǎng)站制作、網(wǎng)站建設(shè),網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行簡陽網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!

url:'http://'+licenseServer+'/licenseManager/license/RegistInfo-addRegist?callback=?',

type:'get',

dataType:'jsonp',

data:{

param:paramObj

},

success:function(msg){

if(msg.success){

alert("授權(quán)申請(qǐng)已提交成功,請(qǐng)等待管理員審核!");

}

},

error:function(msg){

alert("授權(quán)申請(qǐng)?zhí)峤皇?請(qǐng)聯(lián)系技術(shù)服務(wù)!");

}

});

上面是前臺(tái)頁面發(fā)出的請(qǐng)求

public void addRegist(){

try {

String callback = this.getRequest().getParameter("callback");

TRegistInfo regist = WebUtil.requestParam2Bean(getRequest(), TRegistInfo.class);

logger.info("callback="+callback);

logger.info(new GsonBuilder().setDateFormat("yyyy-MM-dd").create().toJson(regist));

regist.setScompanyname(new String(regist.getScompanyname().getBytes("ISO-8859-1"),"UTF-8"));

regist.setSlinkman(new String(regist.getSlinkman().getBytes("ISO-8859-1"),"UTF-8"));

regist.setSregistaddress(new String(regist.getSregistaddress().getBytes("ISO-8859-1"),"UTF-8"));

regist.setSremark(new String(regist.getSremark().getBytes("ISO-8859-1"),"UTF-8"));

regist.setDaddtime(new Date());

if(registInfoBiz.save(regist)){

this.writeResponse(callback+"({success:true})");

}else{

this.writeResponse(callback+"({success:false})");

}

} catch (Exception e) {

logger.error(e.toString());

}

}

這后臺(tái)的代碼包含了業(yè)務(wù),希望你能看的懂,關(guān)鍵還在于callback

在jQuery發(fā)送post請(qǐng)求時(shí),

表單內(nèi)容經(jīng)過serialize()以后就是字符串形式,如:action=edittitle=標(biāo)題id=1

如果你要添加一組數(shù)據(jù),直接這樣就OK

var data=$('#myform').serialize();

data=data+'cont=mycontent'; //增加一組內(nèi)容

再把data扔到$.post里面,就OK 了。

jquery中ajax中post方法傳遞參數(shù)

jQuery ajax - post() 方法:

1、定義和用法:

post() 方法通過 HTTP POST 請(qǐng)求從服務(wù)器載入數(shù)據(jù)。

2、語法:

jQuery.post(url,data,success(data,?textStatus,?jqXHR),dataType)

url :必需。規(guī)定把請(qǐng)求發(fā)送到哪個(gè) URL。

data :可選。映射或字符串值。規(guī)定連同請(qǐng)求發(fā)送到服務(wù)器的數(shù)據(jù)。

success(data, textStatus, jqXHR): ? ?可選。請(qǐng)求成功時(shí)執(zhí)行的回調(diào)函數(shù)。

dataType :可選。規(guī)定預(yù)期的服務(wù)器響應(yīng)的數(shù)據(jù)類型。默認(rèn)執(zhí)行智能判斷(xml、json、script 或 html)。

jquery的post方法怎么使用

head

meta http-equiv="Content-Type" content="text/html; charset=gb2312" /

titleUntitled Document/title

script type="text/javascript" src=\'#\'" /jquery-1.3.2.js"/script

script language="javascript"

function checkemail(){

if($('#email').val() == ""){

$('#msg').html("please enter the email!");

$('#email').focus;

return false;

}

if($('#address').val() == ""){

$('#msg').html("please enter the address!");

$('#address').focus;

return false;

}

ajax_post();

}

function ajax_post(){

$.post("action.php",{email:$('#email').val(),address:$('#address').val()},

function(data){

//$('#msg').html("please enter the email!");

//alert(data);

$('#msg').html(data);

},

"text");//這里返回的類型有:json,html,xml,text

}

/script

/head

body

form id="ajaxform" name="ajaxform" method="post" action="action.php"

p

emailinput type="text" name="email" id="email"/

/p

p

addressinput type="text" name="address" id="address"/

/p

p id="msg"/p

p ?

? input name="Submit" type="button" value="submit" onclick="return checkemail()"/

/p

/form

/body

?php

$email?=?$_POST["email"];

$address?=?$_POST["address"];

//echo?$email;

//echo?$address;

echo?"success";

?

jQuery.post( url, [data], [callback], [type] ) :

使用POST方式來進(jìn)行異步請(qǐng)求

參數(shù):

url (String) :?發(fā)送請(qǐng)求的URL地址.

data (Map) :?(可選) 要發(fā)送給服務(wù)器的數(shù)據(jù),以 Key/value 的鍵值對(duì)形式表示。

callback (Function) :?(可選) 載入成功時(shí)回調(diào)函數(shù)(只有當(dāng)Response的返回狀態(tài)是success才是調(diào)用該方法)。

type (String) :?(可選)官方的說明是:Type of data to be sent。其實(shí)應(yīng)該為客戶端請(qǐng)求的類型(JSON,XML,等等)


網(wǎng)站標(biāo)題:關(guān)于jquery請(qǐng)求post的信息
URL鏈接:http://fisionsoft.com.cn/article/dsedhco.html