2013-03-04 91 views
0

我確定有一個缺少某處的支架或一個額外的,或;。 我收到意外的令牌或意外標識符錯誤!未捕獲的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

您需要關閉你的'$ .ajax'功能的parenthese。 – 2013-03-04 07:54:04

+0

我根據建議@Abhijit Mazumder編輯並重新上傳,因爲還有一個錯誤不會消失。 – JamesT 2013-03-04 08:38:16

回答

0

您還沒有關閉Ajax調用:)

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

:)

+0

謝謝Abhijit。這樣做現在在第36行出現了另一個錯誤「Unexpected token」,它就在「onAnimationResumed」之後的那一行。 – JamesT 2013-03-04 08:10:26

+0

我將它標記爲答案,因爲它讓我在正確的軌道上並解決了問題。 – JamesT 2013-03-04 09:39:58

+0

刪除以下括號:) 'function myStopFunction(){ varPrevious = varJackpot; } **)**;' – 2013-03-04 09:40:50

相關問題