Ajax User

This section describes all of the User methods. Ajax Method Group: Ajax_User

updateUser

Overview

Permission Required: None

Method Call: /ajax/Ajax_User/updateUser

📘

This method allows specific data fields to be updated for the logged in user.

Method Description

Request Parameters

ParameterDetailsExample
user_locationThe ID of an active store location to associate the user with, or 0 to remove an association.99

Response parameters

FieldTypeDescription
successbooleanDenotes whether the request was successful.
messagestringDescribes why a request was not successful. Present only when success is false.
errorsobjectDescribes which fields failed validation. Present only when a field fails validation.

Responses

Successful requests

On success the following will be returned:

{
  "success": true
}

Unsuccessful requests

The following responses will be returned in the event of an error.

If the request is made when there is no active user session:

{
  "success": false,
  "message": "User must be logged in"
}

When the request contains no fields that can be updated:

{
  "success": false,
  "message": "No fields to update"
}	

When the request contains an invalid value:

{
  "success": false,
  "message": "Invalid data",
  "errors": {
    "user_location": "[9999999] is not a valid value"
  }
}

Example Usage

JavaScript

$.post('/ajax/Ajax_User/updateUser', { 
  "user_location": 9999999 
});