News
IBM to offer mobile security as a service IBM will start delivering mobile security-as-a-service (MaaS) through its own cloud infrastructure in India, a move that is expected to better address in-country data requirements... IBM Spectrum Computing: IBM has enlarged its portfolio of software-defined infrastructure solutions with cognitive features for workload management.  * LiFi internet technology has been introduced, the new type of wireless internet connection that gives 100 times faster than traditional WiFi -- Invented by Professor Harald Haas from the University of Edinburgh. * Sci. Rachid Yazami has developed a smart chip that charges smartphones in less than 10 minutes. BenQ has launched BlueCore projector - Consumer electronics major BenQ has launched its first BlueCore laser light source projector. For those unaware, devices with BlueCore laser technology have a high contrast output of 80000:1 with an extended lamp life and efficiency. *** 
  Jan 3 2015 10:34PM     Sara Silva
  0 Comments    1345 Views  
Here Sara Silva gave such a good explanation about jQuery Ajax.
Ajax stands for Asynchronous JavaScript and XML. Ajax is used to Update the part of the web page without reloading the entire page. In other words, Give request to the server and get response with out page reload.
Working flow of Ajax
you can request text, HTML, XML, or JSON from a server using both HTTP Get and HTTP Post using jQuery AJAX methods.
HTTP Get
Get Request can be cached, bookmarked and its remain in the browsers history. And also use Get Request for safe actions.
Hacking is possible with the get request.
HTTP Post
if you are sending large amount of data, you should use HTTP Post because HTTP Get should not carry large amount of data.
Always Better to use HTTP Post when dealing with long request.
Syntax
$.ajax({
            type: "POST",
            url: "aspx-Page-Name/Method-Name",
            data: JSON.stringify({ parameter1: "data1" }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            async: true,
            success: function (data, status) {
                console.log("CallWM");
                alert(data.d);
            },
            failure: function (data) {
                alert(data.d);
            },
            error: function (data) {
                alert(data.d);
            }
        });
Example
<script type="text/javascript">
        $(function () {
            $("#callJqueryAjax").click(function () {
                $.ajax({
                    type: "POST",
                    url: "JQueryAjax.aspx/UpperWM",
                    data: JSON.stringify({ name: "thedevelopertips" }),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    async: true,
                    success: function (data, status) {
                        console.log("CallWM");
                        alert(data.d);
                    },
                    failure: function (data) {
                        alert(data.d);
                    },
                    error: function (data) {
                        alert(data.d);
                    }
                });
            });
        });
    </script>
Hi, This is Sara Silva.I hope this page will helps you to understand the basics of Ajax in jQuery.Thanks.
BackToTop
Comments



 
Search
Recent Posts
Create Amazon ElasticCache Using Memcached in CSharp
Oct 29 2018 12:09PM Posted By Amose
Get Google Map Lat Lng (Geo Point) By Pincode in C#
Oct 28 2018 12:09PM Posted By Pranav
Google URL Shortener in C#
Oct 20 2018 12:09PM Posted By Sanjay
Bind Gridview from CSV file in Asp.Net C#
Oct 5 2018 12:09PM Posted By Michael
Call WebService method from jQuery in every 1 minute
Sep 26 2018 12:09PM Posted By John
Gridview custom CSS in ASP.Net
Sep 14 2018 12:09PM Posted By Micheal Ryan
Read excel file and bind to Gridview in C#
Sep 10 2018 12:09PM Posted By Micheal
Tags
Follow us on Facebook
Follow us on Google +
Recent post in your Email inbox.
Enter your email address: