2016-12-06 1 views
5

나는 새로운 jQuery를 3. 다음은 jQuery를 이전 버전의 작업, 기본 fiddle이지만, 콘솔에서 jQuery를 3jQuery를 3 슬림 아약스 기본 예제

$(function() { 
    $.ajax({ 
     url: '/echo/json', 
     type: 'GET', 
     dataType: 'json', 
     success: function(data) { 
      console.log(data) 
     } 
    }); 
}) 

작동하지 않습니다 해요 이 오류가 발생합니다 :

jquery-3.1.1.slim.min.js:2 jQuery.Deferred exception: $.ajax is not a function TypeError: $.ajax is not a function

jquery-3.1.1.slim.min.js:2 Uncaught TypeError: $.ajax is not a function(…)

왜?

+0

[그냥 변화를 읽을] (https://jquery.com/upgrade-guide/3.0/#ajax) – GillesC

+0

는 당신이 @DavidJorHpan JQuery와 파일 –

+0

와 연결 한 예 물론이야 –

답변

14

jQuery 3 슬림 버전은 아약스를 지원하지 않습니다. release docs에 따르면

,

Along with the regular version of jQuery that includes the ajax and effects modules, we’re releasing a “slim” version that excludes these modules. All in all, it excludes ajax, effects, and currently deprecated code.

단순히 전체 버전을 사용 .ajax 방법을 사용하십시오.

다음은 작업 fiddle

+0

jQuery Slim을 원래 바이올린으로 바꾸려면 왼쪽 메뉴에서 External Resources를 클릭하여 jQuery 리소스를 제거하고 추가하십시오. (jQuery 슬림을 제거하는 방법은 나에게 즉시 명백하지 않다) –

+0

고마워! 그래서 지금 명백해 ... –