How to invoke the initiating AJAX request in Ecstore

Source: Internet
Author: User
Tags mootools

The Ecstore JS Framework uses MooTools, so Ajax calls also use the request component in MooTools.

Grammar:
var myRequest = new Request([options]);
Parameters:
    1. Options-(object, optional) see the following optional
Available options:
    • URL-(string: default is null) the destination URL of the request
    • Method-(String: Default is ' post ') HTTP request methods, can be: ' post ' or ' get '
    • Data-(string: Default = ") The default request parameters provided for the Request:send method
    • Async-(Boolean: Default is True) if False, the request will be synchronized
    • Encoding-(string: default = "Utf-8") how the request is encoded
    • Link-(String: Default is Ignore) can be ' ignore ', ' Cancel ' or ' chain '
      • ' Ignore '-when the request is executing, the new request is ignored
      • ' Cancel '-when the request is executing, the current execution request is canceled immediately, and a new request is started
      • ' Chain '-when the request is executing, the new request is linked to the current request, followed by all requests
    • Headers-(object) Request header data
    • Issuccess-(function) can override the built-in issuccess function to customize the rules for request success

Look at an example in Ecstore:

New Request ({url: ' index.php?app=b2c&ctl=admin_specification&act=check_spec_value_id ',        onsuccess: function (re) {              if (re== ' can ') {                  row.remove ();              } else{                  Messagebox.error (re);}}        ). Post (' spec_value_id= ' +encodeuricomponent (specvid));

Onsuccess is returned after the Ajax call succeeds, and the parameter is the response content ResponseText

Request also has two extension classes:
Request.html is specifically designed to respond to requests for HTML content, and the important parameters are:
Update-(element: default is NULL) the target element to be inserted by the responsetext of the request response
Evalscripts-(Boolean: Default is True) if true, the contents of the script in the response content will be executed
Evalresponse-(Boolean: Default is False) if true, the entire response content will be executed as a script

Request.json is dedicated to sending and receiving JSON-formatted data, where Ajax calls return a JSON-like
Example:

var jsonrequest = new Request.json ({    URL: "http://site.com/tellMeAge.php",    oncomplete:function (person, text) {        alert (person.age);    Displays "Years".        alert (person.height); Displays "+ cm".        alert (person.weight); Display "+ kg".    }}). Get ({    ' firstName ': ' John ',    ' lastName ': ' Doe '});

More Ecstore questions can contact webmaster QQ 1611235299

How to invoke the initiating AJAX request in Ecstore

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.