0

I wish to run some asp.net code on a page generated by Wordpress. Is there a way using XMLHttpRequest() to make JavaScript interact with .aspx page just like a Servlet?

For example, I hope that I can do this in JavaScript:

xmlHttpRequest.open("POST", "http ://some.aspx", true);
send_request("request=add,1,2");
function getReadyStateHandler(xmlHttpRequest) {
    //handle_response
}

How to write and configure such an asp page? Does someone know a good tutorial?

Thanks a lot!

ulluoink
  • 2,775
  • 2
  • 17
  • 22
  • possible duplicate of [ASp.net Ajax examples for the beginner](http://stackoverflow.com/questions/1102941/asp-net-ajax-examples-for-the-beginner) – Matas Vaitkevicius Apr 29 '14 at 11:17

1 Answers1

0

You are better of using JQuery for this task.

It is Javascipt library that has exactly functionality that you re looking for You can call your backend methods to invoke serverside action that would return JSON object. and then in done function process the result.

$.ajax({
  url: "test.html",
  context: document.body
}).done(function(result) {
var dataFromTheSreverside = result;
  $( this ).addClass( "done" );
});

Here you can find a lot of examples

Community
  • 1
  • 1
Matas Vaitkevicius
  • 58,075
  • 31
  • 238
  • 265