I want to create a JavaScript application like gMail with:
Framework: ASP.NET
Browser Framework: jQuery
Database: MySQL
My idea is:
When the window.onhashchange
fires up, I load the right content dynamically:
main.loadContent = function (file) {
$("#content").load(file); } // in this example, users.aspx
the JavaScript file users.js
gets loaded too, and on DOM ready, I get some information from the server via AJAX:
$.ajax({
type: "POST",
url: "WebService.asmx/GetUsers",
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
// fill the fields
}
});
the function GetUsers, in the webservice, fires up and returns data from the database:
public class WebService : System.Web.Services.WebService
{
[WebMethod]
public void GetUsers()
{
try
{
return Users.GetUsers(); //some logic and database query
}
catch (Exception ex) { Global.HandleException(ex); }
}
}
So, is this a good way or do you have a better one?