A
A
artshelom2017-11-22 18:30:57
JavaScript
artshelom, 2017-11-22 18:30:57

Ajax does not work, writes an error: "Uncaught ReferenceError: $ is not defined" how to fix it??

The following error pops up: "Uncaught ReferenceError: $ is not defined" I

connected the library:

<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/JQscript.js"/> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>

the request is not sent, it just writes an error, the code is elementary:
function nextNewxBox() {


      $.ajax({
          type:'get',//тип запроса: get,post либо head
          url:'/news',//url адрес файла обработчика
          data:{'z':'1'},//параметры запроса
          response:'text',//тип возвращаемого ответа text либо xml
          success:function (data) {
              alert('KEK');
              alert(data)
              //      $(’#StartDate’).val().toString();
          },
          error:function () {
              alert('qwe');
          }
      })

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2017-11-22
@miraage

Change the script loading order.

A
artshelom, 2017-11-22
@artshelom

Thanks everybody. Issue resolved!
If someone will transfer libraries, then do not throw them into style tags

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question