function query(url,sendData,myevent)
{
sendData="data="+encodeURIComponent(encodeURIComponent(JSON.stringify(sendData)));
$.ajax({
type : 'post',
url : url,
data : sendData,
dataType : 'json',
success : function(data) {
if(myevent!=null||myevent!=undefined)
$.event.trigger(myevent,data); //fire event
},
error:function(data){
console.log("网络错误"+JSON.stringify(data));
}
});
}
/*
depend JSON2.js, jquery
@para url the query url
* @para sendData the data you send
*
* @para myevent when query succeed , it will trigger this event,its type is string
*
* for example
* $.bind("getData",function(evt,data){
console.log("eventClick");
});
* query("analysis",sendData,"getData");
*/