18.02.2015 Views

5ml User's Guide

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 8: Customizing Page Elements<br />

Sending a POST HTTP Request to a Web Service Expecting Simple HTTP FORM POST Data<br />

Note: Do not pass complex structures for the data parameter, when using the FORM POST Content-Type.<br />

function httpPost() {<br />

var data = {<br />

"clientId" : "corning_gorilla",<br />

"msgId" : '1'<br />

}<br />

var headers = {<br />

'Content-Type' : fiveml.proxy.TYPE_FORM_POST<br />

}<br />

fiveml.proxy.sendRequest("http://some.remoteservice.net/api/post", 'POST', data,<br />

function(req){alert(req.responseText);<br />

}, headers);<br />

}<br />

Sending a POST HTTP Request to a Web Service Expecting XML Data<br />

function xmlPost() {<br />

var data = '';<br />

var headers = {<br />

'Content-Type' : fiveml.proxy.TYPE_XML<br />

}<br />

fiveml.proxy.sendRequest("http://some.remoteservice.net/api/xml", 'POST', data,<br />

function(req){alert(req.responseText);<br />

}, headers);<br />

}<br />

Exporting Projects that Include <strong>5ml</strong> Proxy API Calls<br />

You do not need to perform any other configuration after you export the project for the proxy requests to work. The<br />

proxy.php is included in the exported package only if the proxy is used by the custom code in the Script Editor.<br />

- 230 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!