Pergunta

How to write the underlying code given in the Moxtra API in jQuery or JavaScript

POST /v1/UiaduESWsbzFoK9TOldC6zF/binders

{

    "name": "My First Binder"
}


{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "id": "B7U3ze39oO08PYO70973lX6",
        "name": "My First Binder",
        "revision": 3,
        "created_time": 1342813061602,
        "updated_time": 1342813061602
    }
}
Foi útil?

Solução

Assuming you want to POST the first object and receive the second object as a successful response, here's how you'd do it with jQuery's shorthand AJAX POST function:

var data = {"name": "My First Binder"};

$.post("/v1/UiaduESWsbzFoK9TOldC6zF/binders", data, function(response) {
  // Response object contains your response from the server
  console.log(response);
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top