1

我收到这些行的识别错误

是否有任何在线验证器可以帮助我?

showAliveTests : (pageIndex, statusFilter) ->
    data=
            pageIndex:pageIndex
            status:statusFilter
        $.ajax 
            url:'/ManageConfiguration/GetAliveConfigurations/' + location.search
            type:"post"
            data:data
            dataType:"json"
            success:(res)->
                if res.status == "failed"
                    alert res.body
                else
                    $('#viewConfigurationTable tr').remove()
                    newRow =    $ '<tr>'
                    newRow.append('<td>Id</td>
                                    <td>Name</td>
                                    <td>Status</td>
                                    <td>Ctids</td>
                                    <td>CreationDate</td>')
                    $('#viewConfigurationTable').append(newRow)
                    for obj in res.body
                        newRow =    $ '<tr>'
                        newRow.append('<td>'+obj.Id+'</td> 
                                        <td>'+obj.Name+'</td>
                                        <td>'+obj.Status+'</td>
                                        <td>'+obj.Ctids+'</td>
                                        <td>'+obj.CreationDate+'</td>')
                    $('#viewConfigurationTable').append(newRow) 
                    $(#paginator a).remove()
                    for i in [0..count] by 1
                        $(#paginator).append('<a href=#>'+i+'</a>') 

            error:(e)->
                alert 'An error has occured: ' + e
4

2 回答 2

4

www.coffeescript.org -> 点击试试我,把你的代码粘贴进去,你会看到哪一行抛出了错误。

在您的情况下,即使使用 stackoverflow 代码突出显示,您也可以看到它:

$(#paginator a).remove() -> wrong
$('#paginator a').remove() -> correct

第二个错误

$(#paginator).append('<a href=#>'+i+'</a>')  -> wrong
$('#paginator').append('<a href=#>'+i+'</a>')  -> correct
于 2013-01-21T16:10:44.803 回答
1

你忘记了周围的报价#paginator apaginator

#...
$("#paginator a").remove() # you had: $(#paginator a)
for i in [0..count] by 1
    $("#paginator").append('<a href=#>'+i+'</a>') # you had: $(#paginator)
#...
于 2013-01-21T16:17:21.680 回答