communicate with database using jQuery AJAX and ASP.NET
I have been reading this article:
Many ways to communicate with your database using jQuery AJAX and ASP.NET
This article describes many ways to communicate with the database using jQuery and AJAX.开发者_如何学Python Personally I use .ASHX
handlers to get the data.
Can any one tell me which way considered the best in terms of being lightweight and performing well no matter how large the database is?
If you're stuck with ASP.NET forms and aren't able to utilise ASP.NET MVC then .ashx
handlers will be fine. They don't have all of the overhead of the full ASP.NET forms .aspx
page.
As far as performance is concerned, as always, you should only return the data you need and provided your database is tuned and your SQL queries are sensible then life will be good.
One thing I would suggest is instead of returning HTML, consider returning data as JSON. It's more compact and portable. Also JSON objects rehydrate into javascript objects that you can manipulate directly. There are many JSON serialisers available for .NET, I consider Json.NET to be one of the better ones.
精彩评论