This project is read-only.
Project Description
This project code build Client Side JavaScript Wrapper Class for each Controller Action based on reflection, and user just need to define simple Event Handler function, and then can enjoy the Ajax Feature!
Example:
System.IncludeJs('/Content/Controllers/EchoController.js'); //EchoController.js is auto generated Controller Action Wrapper Class in JavaScript
function update(data)
{
var reContainer = $('#ResponseStatus');
resultObject = eval("(" + data + ")");
var result ='';
result = 'Your Name ' + resultObject.Name+ ' Call to Server time' + resultObject.CreateTime;
reContainer.html(result);
reContainer.show();
}
function before(){$('#LoadingArea').show();}
function after(){$('#LoadingArea').hide();}
function error(){ alert('error');}
var ajaxWrapper = AjaxCodeBuidlerMvcApplication_Controllers_EchoController_NameActionClass.Singleton.getInstance();
ajaxWrapper.addBeforeSendListener(before);//Before Ajax call Event Handler
ajaxWrapper.addOnSuccessListener(update); //Success Ajax call Event Handler
ajaxWrapper.addOnCompleteListener(after); //CompleteAjax call Event Handler
ajaxWrapper.addOnErrorListener(error); //Error Ajax call Event Handler
function loginButtomOnClick() { ajaxWrapper.getView($('#yourName').val());} //Ajax Call

Now, the code is based on JQuery and some Script# JavaScript Library, and I hope to have the next release with the object migration between JavaScript domain and C# domain.


Last edited Aug 5, 2008 at 4:44 PM by cyruswong, version 2