I'm trying to get familiar with ASP .net so after 'hello world' I was trying to add some simple backend request handling. So I'm doing an Ajax request from my page to the asp page :
Ext.Ajax.request({
type: 'POST',
url: 'http://http://localhost:49852/Default.aspx',
params: {
html : {'array': document.body.innerHTML}
},
success : function(response){
console.log('RESPONSE !', response);
//me.onSuccess(response, callback, errback);
},
failure : function(response){
console.log('RESPONSE FAIL !', response);
}
});
And this is my page :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
And the code that's behind it (I'm not sure if the structure should look like this, but I wasn't able to find any example of requests handling without forms used) :
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
if (this.Request["html"] != null){
this.Response.Write("{'success': true, 'msg': 'Its working'}");
}
else{
this.Response.Write("{'success': false, 'msg': 'Error in request data.'}");
}
}
}
Now if I go to this address in my browser, I'm getting the proper (false) text displayed. But when I'm trying with XHR request, I can't see any request in the Firebug console at all, and in the Net tab I get 'OPTIONS' response :
which looks as follows when logged to console :
Any ideas what's goin on here ?