“Ajax” Kod odpowiedzi

Ajax

With Ajax, web applications can send and retrieve data from a server asynchronously without interfering with the display and behaviour of the existing page.
Yellowed Yak

Ajax


        var model =
        {
            industryCode : value
        }

        $.ajax({
            url: "/Setting/GetSubIndustryList",
            type: "POST",
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            async: false,
            data: JSON.stringify(model),
            success: function (res) {
                console.log('doGetBeamSubIndustry success');
                $("#txtBusinessSubIndustry").find('option').remove();

                $.each(res.message, function (index, value) {
                    $("#txtBusinessSubIndustry").append("<option value=" + value.code + ">" + value.names.en + "</option>");
                });

            },
            error: function (jqXHR, exception) {
                console.log('doGetBeamSubIndustry error');
                console.log(jqXHR.responseText);
            }
        });
Thitipong Hangwongpaibool

Ajax

var xhr = new XMLHttpRequest;
var url = "/?lorem=ipsum";

//GET request
xhr.open('GET', url); //Open the request with the specified url.
xhr.onreadystatechange = () => {
  //Checking if the request has finished and if it was successfull  
  if (xhr.readyState == 4 && xhr.status == 200) {
        console.log(xhr.responseText); //Printing out the response. 
    	//You can also use xhr.responseXML
    }
}
xhr.send(); //This sends the request to the server with the specified params.
Plain Piranha

Ajax

AJAX - Asynchronous JavaScript And XML
Bahriddin Mo'minov

Ajax

$.ajax({
    url: 'some_unknown_page.html',
    success: function (response) {
        $('#post').html(response.responseText);
    },
    error: function (jqXHR, exception) {
        var msg = '';
        if (jqXHR.status === 0) {
            msg = 'Not connect.\n Verify Network.';
        } else if (jqXHR.status == 404) {
            msg = 'Requested page not found. [404]';
        } else if (jqXHR.status == 500) {
            msg = 'Internal Server Error [500].';
        } else if (exception === 'parsererror') {
            msg = 'Requested JSON parse failed.';
        } else if (exception === 'timeout') {
            msg = 'Time out error.';
        } else if (exception === 'abort') {
            msg = 'Ajax request aborted.';
        } else {
            msg = 'Uncaught Error.\n' + jqXHR.responseText;
        }
        $('#post').html(msg);
    },
});
ApolloGab Delmundo

Ajax

$.ajax({
        method :'GET',
        url: baseUrl+'ajaxcontroller/LoadData_To_View',
        success:function(data){
        $('#item').html(data);
        alert(data);
        },
        complete: function(){
        $('#loadingImage2').hide();
        },
        error:function (xhr, ajaxOptions, thrownError){alert(thrownError);}
        });
Jolly Jackal

Odpowiedzi podobne do “Ajax”

Pytania podobne do “Ajax”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu