GithubHelp home page GithubHelp logo

mimic.js's Introduction

Mimic

This is a fork of original Mimic created by Carlos Eduardo Gonçalves. I've created it in order to extend it with async support and make the library available in bower.

Mimic is an open source XML-RPC client implemented in JavaScript. It was classified as client, because it is only able to produce requests and parse responses, so you cannot use it to parse requests and produce responses as required for a server implementation.

It is intended to be embedded inside web pages and enable them to access web services based on XML-RPC through the W3C XMLHttpRequest interface.

It is compliant with the major browsers (IE, Firefox, Opera, Safari and Chrome).

How to Use

It is very simple to use Mimic, you only have to produce a request and then process the response. To do it you only have to use two small objects XmlRpcRequest and XmlRpcResponse.

Synchronous request example:

function callCalculator() {
  var method = document.getElementById("operation").value;
  var request = new XmlRpcRequest("demos/calc.php", method);

  request.addParam(document.getElementById("n1").value);
  request.addParam(document.getElementById("n2").value);

  var response = request.send();

  alert(response.parseXML());
}

Asynchronous request example:

function callCalculator() {
  var method = document.getElementById("operation").value;
  var request = new XmlRpcRequest("demos/calc.php", method);

  request.addParam(document.getElementById("n1").value);
  request.addParam(document.getElementById("n2").value);

  request.send(function (response, status) {
    if (status === 200) {
      alert(response.parseXML());
    }
  });
}

mimic.js's People

Contributors

karolsluszniak avatar

Stargazers

Sakir Temel avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.