2013-03-04 2 views
0

Я уверен, что здесь отсутствует скобка, где-то здесь или дополнительно, или;. Я получаю неожиданный токен или неожиданные ошибки идентификатора!Uncaught SyntaxError: Неожиданный идентификатор в ajax-jquery

<script type="text/javascript"> 
    $(document).ready(function() { 
     setInterval("ajaxd()",10000); 
    }); 
     varJackpot =0; 
     varPrevious=0; 
    function ajaxd(){ 
     $.ajax({ 
     type: "GET", 
     url: "getJackpot.asp?dx=<%=skinid%>", 
     data: "", 
     success: function(data){ 
     varJackpot =data[0]; 
     varPrevious =data[0]; 
     } 
    }) 

    $("#counter").flipCounter(
     "startAnimation", // scroll counter from the current number to the specified number 
     { 
     number: 5, // the number we want to scroll from 
     end_number: 1024, // the number we want the counter to scroll to 
     easing: jQuery.easing.easeOutCubic, // this easing function to apply to the scroll. 
     duration: 5000, // number of ms animation should take to complete 
     onAnimationStarted: myStartFunction // the function to call when animation starts 
     //onAnimationStopped: myStopFunction, // the function to call when animation stops 
     //onAnimationPaused: myPauseFunction, // the function to call when animation pauses 
     //onAnimationResumed: myResumeFunction // the function to call when animation resumes from pause 
    }) 
    function myStopFunction() { 
    varPrevious = varJackpot; 
    }); 
    } 
</script> 

Вызов getJackpot.asp возвращает одно число. Пример:

url: "getJackpot.asp?dx=7", 

будет возвращать что-то вроде 12345,95

Неожиданное знак: линия 39

Вся эта вещь основана на FlipCounter по этой ссылке. Любые указатели будут оценены очень сильно.

+0

Вам нужно закрыть Parenthèse вашего '$ .ajax' функции. –

+0

Я отредактировал на основе предложения @Abhijit Mazumder и снова загрузился, так как есть еще одна ошибка, которая просто не исчезнет. – JamesT

ответ

0

Вы не закрыли АЯКС звонок :)

$.ajax({ 
        type: "GET", 
        url: "getJackpot.asp?dx=<%=skinid%>", 
        data: "", 
        success: function(data){ 
        varJackpot =data[0]; 
        varPrevious =data[0]; 
        } 
       } **)** 

:)

+0

Спасибо Abhijit. Теперь это вызвало еще одну ошибку в строке 36 «Неожиданный токен», которая является строкой сразу после «onAnimationResumed» – JamesT

+0

. Я отметил это как ответ, так как он получил меня на правильном пути и решил проблему. – JamesT

+0

удалите следующую скобку :) 'function myStopFunction() { varPrevious = varJackpot; } **) **;' –

Смежные вопросы