Http Request & Response from Java script

Posted by Nishithraj under ASP.NET category on | Views : 3417
HttpRequest can be accessed from javascript.
This would be helpful for us to do the Http related activities(Such as setting header etc )

var objHttp = this.prototype;

To mention the HttpRequest by following line
objHttp.defineProperty("requestMethod", "GET");

To get the reponse text use the following code.
objHttp.defineProperty("responseText", this._http.responseText);

get the username and password as follows

objHttp.defineProperty("username", null);
objHttp.defineProperty("password", null);

You can even set the request header through javascript
objHttp.setRequestHeader("Content-Type", "application/-----");

Comments or Responses

Login to post response