I have a service that registers on a system (from 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 response from this service stays like this ...
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 the values of the responseText? this "[{" id ": 29," username ":" arques_nathalia "}]"
I wanted to store at least one ID in a variable, is it possible?