Hi,
I need an ajax plugin to handle using PUT method and to submit a GET request with a custom header and get the response header too.
I have copied the oringal ajax plugin and got the PUT action, but i am trying to add a GET request with custom headers & response. I am struggling to get that to work.
[b]Edittime.js[/b]
AddStringParam("Tag", "A tag, which can be anything you like, to distinguish between different AJAX requests.", "\"\"");
AddStringParam("URL", "The URL to put to. Note: most browsers prevent cross-domain posts.", "\"http://\"");
AddStringParam("Data", "The data to put, in query string form. Be sure to URLEncode any user-entered data.");
AddAction(3, 0, "Put to URL", "AJAX", "PUT <b>{2}</b> to URL <b>{1}</b> (tag <i>{0}</i>)", "Make a PUT request to a URL.", "Put");
AddStringParam("Tag", "A tag, which can be anything you like, to distinguish between different AJAX requests.", "\"\"");
AddStringParam("URL", "The URL to put to. Note: most browsers prevent cross-domain posts.", "\"http://\"");
AddStringParam("HeaderKey", "Header Key");
AddStringParam("HeaderValue", "Header Value");
AddAction(4, 0, "Request URL with Header", "AJAX", "Request <b>{2}</b> to URL <b>{1}</b> (tag <i>{0}</i>) with header: <i>{3}</i> with <i>{4}</i>", "Request URL with Header.", "RequestHeader");
AddExpression(2, ef_return_string, "Get Header Responce", "AJAX", "HeaderResponce", "Get the header responce");
[b]Runtime.js[/b]
Acts.prototype.Put = function (tag_, url_, data_)
{
this.doRequest(tag_, url_, "PUT", data_);
};
Acts.prototype.RequestHeader = function (tag_, url_, headerkey_, headervalue_)
{
this.doRequest(tag_, url_, "GET", headerkey_, headervalue_);
};
Exps.prototype.HeaderResponce = function (ret)
{
var requests;
this.xhr = sinon.useFakeXMLHttpRequest();
this.xhr.onCreate = function(xhr) {
?requests.push(xhr);
}
ret.set_string(requests);
};
But when i added either of these the normal ajax call action stops working.
Any help would be great.
Need to have something working by end of day :(