html中ajax用法

后台处理参数,生成结果数据:
data['plan_list'] = plans//data是字典
req.send(json.dumps(data).encode('utf-8'))//转成json数据
前台传送参数,接收结果
$.ajax({
	type:'post',
	url:"/myTrac/projectmanage/project/plan_project",
	data:{
		"new_plan_flag":'1',
		"plan_name":$('#plan_name_new').val(),
		"project_name":project_name,
		"stage_list":stage_list.join('[flag]'),
		__FORM_TOKEN:$('#trac_form_token').val()
	},
	async:false,
	success:function(data){
	data = eval("("+data+")");//解析json数据
		if(data.status = "Success"){
			alert("已保存")
		}else{
			alert('Create Fail,Please Check !')
		}
	}
});

你可能感兴趣的:(html中ajax用法)