[RESOLVED]Bracket Issue

Hi,

Intellisense is giving me this error:

<script type="text/javascript">
        var pagno = 1;
        $(document).ready(function () {
            fnBuildData();
                $("#btnComments").bind("click", funtion() { //<- ERROR HERE (Expected ',' or ')')
                 fnBuildData();
                 return false;
                }) //<- ERROR HERE (Expected Expression)
            }); //<- ERROR HERE (Syntax Error)


        function FnBuildData() {
            $("#imgLoading").Show();
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "CommentService.asmx/GetComments",
                data: '{"PageNo" : "' + pagno + '","RowCount":"<%= rowsCount %>"}',
                dataType: "json",
                success: function (msg) {
                    var nextRows = <%= rowsCount %> + 1;
                    pagno += nextRows;
                    var cmntObject = msg.d;
                    $("imgLoading").hide();
                    if(cmntObject.length < nextRows)
                    { $("#btnComments").hide(); }
                    $.each(cmnObject, function (index, cmnt) {
                        $("#ResultsTable").append("<table><tr><td>Name:</td><td>"
                        + cmnt.UserName + "</td></tr><tr><td>Title :</td><td>" +
                        cmnt.Title + "</td></tr><tr><td colspan='2' nowrap='nowrap'>"
                        + cmnt.CommentBody + "<hr/></td></tr></table>");
                    });
                }
                ,
                error: function () {alert('Error Ocurred, try later.'); $("#imgLoading").hide();}
            });
        }
    
    </script>

I keep looking at it, but the brackets match. Any ideas?

Thanks 

 

Never mind.

I type over it, the exact same thing, and the error went away. No idea why. Yell 

Diomedes

Never mind.

I type over it, the exact same thing, and the error went away. No idea why. Yell 

Hello,

Sometimes it take a bit of time to update the intellisense so the errors will go away after a while. Best thing is to build the project and see.

It was giving me the errors on browser too. I have no idea why. For example, you see that funtion is not on the right color, when I retype it, it turn blue. Also fnBuildData.

Maybe it was the encoding of the text? No idea.

After I fix it, that error went away I did find two more errors on it, Show should be show, no capital. But at least the error message told me the error was in the word show. 

The error is right there on the first line

$("#btnComments").bind("click", funtion() { //<- ERROR HERE (Expected ',' or ')')

Spelling counts. :)  funtionThe color coding in the editor points it out.

Eric

Spelling is so overrated. :-p

Google should make an add on for VS. The it would be like ‘you type funtion, did you mean function?’

Diomedes

Spelling is so overrated. :-p

Google should make an add on for VS. The it would be like ‘you type funtion, did you mean function?’

I make this mistake daily. :)

Leave a Reply