Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

javascript frameworks prototype to jquery -


i have found following script apparently written using javascript framework prototype.

event.observe(window, 'load', function() {      event.observe( 'btnsubmit', 'click', purchasecd);      connecttoserver(); });  function connecttoserver() {     new ajax.updater(         { success: 'cd count', failure: 'errors' },         'server_side.php',         {             method:     'get',             onsuccess:  function(transport)             {                 if (parseint(transport.responsetext)) connecttoserver();             }     }); }  function purchasecd() {     new ajax.updater(         { success: 'cd count', failure: 'errors' },         'server_side.php',         {             method:     'get',             parameters: { num: $('txtqty').getvalue() }     }); } 

is here able convert script use jquery instead of prototype? don't know prorotype @ don't understand it.

ajax.updater takes, parameter 1, 2 containers update successful or failed response of request url given in parameter 2.

what script upon page load (i translated below domready not same, jquery convention) ajax request sent server_side.php. if gets response understands, sends off request, in order keep session alive.

this looks terrible design. if you're going that, want timeout between requests.

another thing that's not neat script every ajax request handled same page - server_side.php - relying on different parameters instructions on action perform. appear cleaner request different pages different actions.

$(function() {     $('#btnsubmit').click(purchasecd);     connecttoserver(); });  function connecttoserver() {     $.ajax({         url: "server_side.php",         success: function(res) {             $('#cd count').html(res);             if(parseint(res))                 connecttoserver();         },         error: function(xhr) {             $('#errors').html(xhr.responsetext);         }     }); }  function purchasecd() {     $.ajax({         url: "server_side.php",         success: function(res) {             $('#cd count').html(res);         },         data: { num: $('#txtqty').val() },         error: function(xhr) {             $('#errors').html(xhr.responsetext);         }     }); } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -