簡體   English   中英

如何用無jquery的XmlHttpRequest方式交換jQuery.ajax調用?

[英]How can I swap jQuery.ajax call with jquery-less XmlHttpRequest way?

您能否幫助我將下面的jQuery ajax調用與XmlHttpRequest交換,從而不需要jQuery? (我還需要交換:

jQuery.support.cors = true; 

當我不使用jQuery.ajax而是XmlHttpRequest時?

jQuery.support.cors = true; 

var endpointAddress = "http://My.Server.FooService/FooServices.svc/";
var url = endpointAddress + "/SubmitFoo";
        $.ajax(
            {
                type: 'POST',
                url: url,
                contentType: 'application/json',
                data: JSON.stringify(request),
                success: function (result) {
                    alert("Foo submitted succesfully!");
                },
                error: function (jqXHR, textStatus, errorThrown) {

                    alert('Error Occured' + errorThrown);
                }
            }               //eof ajax object
        );  //eof .ajax
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM