Simcy Creative
  • What is Simcify
  • Requirements
  • Getting Started
  • Javascript Functions
    • Simple js Functions
    • Interaction Functions
      • Loader
      • Notifications
      • Credit Card Form
    • Helper Functions
      • Random
      • Cookies
      • Send to server(Ajax)
      • Server Responses
    • HTML helpers
      • Form Processing
      • Send onClick
      • Send onChange
      • Fetch & Display
      • Dropify
      • Switchery
      • Crop Image Input
      • Image Preview
  • PHP Functions
    • Introduction
    • Setup
    • Authentication
      • Login
      • Register
      • Forgot Password
      • Reset Password
    • Configuration
    • Email & SMS
      • SMS
        • Africa's Talking
        • Twilio
      • Email
    • Files Manager
      • Upload
      • Delete
Powered by GitBook
On this page
  • Usage
  • Response Explanation
  1. Javascript Functions
  2. Helper Functions

Server Responses

Simcify has a function that handles server responses. The function can still be called even if the response is not from the server as long as the correct JSON format is passed.

below are the expected response from server for this function;

Response should be in JSON format only.

Usage

Here is sample usage;

serverResponse({
    "status":"success",
    "title":"Changes saved!",
    "message":"Your changes have been saved successfully.",
    "notify": true,
    "notifyType":"swal",
    "callback":"reload()",
    "callbackTime":"onconfirm",
    "showCancelButton": true,
    "buttonText": "View Changes"
});

Response Explanation

item

Required

Type

Description

status

Yes

string

warning | success | info | error (info is default).

title

Yes|No

string

Response title. (required if notify is true and notifyType is toastr).

message

Yes|No

string

Response message. (required if notify is true and notifyType is toastr).

notify

No

boolean

whether to notify user on complete, default is true.

notifyType

No

string

use "swal" or "toastr", default is "swal".

callback

No

string

callback function.

callbackTime

No

string

"instant" or "onconfirm", if notifyType is toastr, callbackTime must be instant.

showCancelButton

No

boolean

only added when notifyType is swal.

buttonText

No

string

label of confirm button, only added when notifyType is swal.

PreviousSend to server(Ajax)NextHTML helpers

Last updated 6 years ago