How can I calling a webservice not written by me from asp.net ajax. What's the latest and best way of doing it?
Call the Sys.Net.WebServiceProxy invoke Method
Details here
ASP.NET AJAX is not the preferred library any more. Use jQuery instead which also supports jsonp which is what you will need to call cross-domain web services from the client.
Related
I want to know whether there is any better option to perform AJAX operations in my ASP.net webforms other than Updatepanel.
Because updatepanel sends lot of viewstate data in the request which in term affects the peroformace of the Application.
Thank You in Advance
You have a few options. You can disable ViewState, or you can use "plain AJAX".
If you choose to use "plain AJAX", you can write your low level JavaScript code or use libraries such as jQuery to make the AJAX calls easier.
On the server side, you'll need to expose some kind of endpoint for the AJAX calls to communicate to. Some people use WebMethod, but that has been deprecated and I would avoid this approach. You can use ASP.NET Web API in .NET 4.5, or in any version of .NET you can use handlers or generic handlers (.ashx) to expose endpoints.
Ajax needs xmlhttp. Does Asp.net ajax, ajaxcontrol toolkits also needs xmlhttp for their smooth running.
Depending on the browser it will use either the built-in XmlHttpRequest object or an ActiveX control.
Ajax is XMLHttpRequest, so in short, yes ASP.Net needs that (or ActiveX for IE).
Yes, this is the browser component that AJAX uses to makes requests to the server. The AJAX Toolkit, or more specifically any control that gets data from the server, would require it. However, the way the toolkit runs...I'm not sure if any controls will run with it disabled, as the base set of client scripts expects it to be enabled.
You can read more about how AJAX utilizes XMLHttpRequest object here.
I'm using jQuery with ASP.NET 3.5 and the ajaxDotNet plugin. What are the differences are between these two?
ajaxDotNet plugin uses the jQuery's native ajax functions but it is specifically designed for calling ASP.NET PageMethods and JSON enabled web services.
i am looking for a basic example that shows how i could call a webservice with the client side javascript that comes with the ASP.NET Ajax Toolkit.
i already found some example that shows how you do it with ASP.NET WebForms but i am using ASP.NET MVC so no fancy ScriptManager for me :(
does somebody know a insightful blog posting about this topic?
tia
I recommend using JQuery and this guide is very straightforward for calling an ASP.NET Web Service:
http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/
Perhaps this can help you?
Using jQuery with ASP.NET MVC
AJAX Panels with ASP.NET MVC
Adding Ajax Support to the ASP.NET MVC Framework
See this post for a description of how this can be accomplished using AJAX for ASP.NET MVC.
If you have control of the service your self and if it is possible you could consider exposing it as a REST-like interface via WebHttpBinding and WCF. Then use jQuery to query the service.
When using the AJAX functionality in jQuery, do I also have to have ASP.NET AJAX/.NET 3.5 installed also? or can I only use ASP.NET AJAX?
I'm unclear on whether or not I'm able to use AJAX in ASP.NET without ASP.NET AJAX or not.
No, you don't need ASP.NET AJAX installed to use the AJAX functionality of jQuery.
You can call PageMethods and Web Services without needing a ScriptManager control (which generates the JavaScript proxy objects that allow you to use familiar syntax to call web services and page methods).
Article on using jQuery to directly call ASP.NET AJAX page methods
Article on using jQuery to Consume ASP.NET JSON Web Services
Let me first clarify the use of jQuery. jQuery is simply a javascript library, and it has nothing to to with ASP.NET or any other server side platform such as PHP or JSP.
So you can simply use jQuery side by side with ASP.NET, or even combine jQuery with ASP.NET 3.5 that has AJAX built in.
You can also use jQuery's AJAX if you like, and it still can run in ASP.NET. If you want to combine both, please test your aspx page first if you also want to use ASP.NET's UpdatePanel with jQuery's AJAX, since it can bring incompatibilities between them.
No, if you're using jQuery you don't need ASP.NET AJAX installed.
ASP.NET Ajax is not needed in order to use jQuery, but the two work well together, hence the support from Microsoft.