1
I have a service that registers in a system (the code below)
var userstocreate = [
{
username: '' + usuario + '',
password: 'E@d123456',
firstname: '' + primeiro +'',
lastname: '' + lastname + '',
email: '' + email + ''
}];
var data = {
wstoken: token,
wsfunction: functionname,
moodlewsrestformat: 'json',
users: userstocreate
}
var response = $.ajax(
{
type: 'POST',
data: data,
url: serverurl
});
The answer of this service is thus...
abort: (a)
always: ()
complete: ()
done: ()
error: ()
fail: ()
getAllResponseHeaders: ()
getResponseHeader: (a)
overrideMimeType: (a)
pipe: ()
progress: ()
promise: (a)
readyState: 4
responseJSON: Array[1]
responseText: "[{"id":29,"username":"arques_nathalia"}]"
setRequestHeader: (a,b)
state: ()
status: 200
statusCode: (a)
statusText: "OK"
success: ()
then: ()
__proto__: Object
How can I save responseText values? that "[{"id":29,"username":"arques_nathalia"}]"
wanted to save in a variable at least the ID, is possible?
You redeem these values on
callbackof function Ajax, in thesuccess, for example.– Diego Souza
How? Do you have an example? I did so Success: Function (data) { var result = data; } but I cannot use this result variable
– Yuri Rodrigues