PDA

View Full Version : [CLOSED] JQuery to Ext.net



supera
Sep 10, 2012, 9:59 PM
Hi! I'm using JQuery to call my webservices in client side (javascript)... But I wish change this to ext.net equivalent function...

What is the equivalent function in Ext.net/ExtJS? In my jQuery function bellow, in successFn, I get a parameter called 'data' with returned object of WebService.

My function is this:



function CallJsonWebService(url, params, fnSuccess, fnError) {

if (fnSuccess == undefined) {
fnSuccess = function (data, status) { alert(data.d); };
}

if (fnError == undefined) {
fnError = function (xhr, msg, e, p1, p2, p3) {
trataErro({ number: xhr.status, msg: xhr.responseText });
};
}

if (params != undefined) {
params = JSON.stringify(params);
} else {
params = {};
}

$.ajax({
type: "POST",
url: url,
data: params,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: fnSuccess,
error: fnError
});
return true;
}

Daniil
Sep 11, 2012, 8:38 AM
Hi,

Please use the Ext.net.DirectMethod.request method. Here is an example.
http://examples2.ext.net/#/Events/DirectMethods/WebService/

supera
Sep 12, 2012, 7:08 PM
Hi Daniil!

Works fine... thanks a lot for your help!