Ronnie
Ronnie

Reputation: 11198

jQuery, Expected identifier, string or number in IE6 and 7

I have an issue in IE6 and 7 where I am making an ajax request. The error is: Expected identifier, string or number on line 262 which is pointing to:

$("#submitNewAdmin").live('click',function()
{
    $.ajax({
        type: "POST",
        url: "resources/ajax/ajax_new_admin.php",
        data:{
            username:$(".pp_inline #username").val(),
            password1:$(".pp_inline #password1").val(),
            password2:$(".pp_inline #password2").val(),
            email:$(".pp_inline #email").val(),
        },
        success: function(msg)
        {
            if (msg == "success")
            {
                location.reload(true);
            }
            else
            {
                alert(msg);
            }
        }
    });
});

the line where success takes place. I've googled around and the solutions to other peoples issues are that they had an extra comma. I have looked over my code and I cannot find an extra comma..can anyone see anything I am doing wrong? All of this code is wrapped in $(document).ready(function(){});. Also, I am using jquery-1.7.1.min.js

Upvotes: 0

Views: 1006

Answers (1)

Andrew Whitaker
Andrew Whitaker

Reputation: 126042

Here's the extra comma (and yes, it will certainly cause you problems in IE):

    data:{
        username:$(".pp_inline #username").val(),
        password1:$(".pp_inline #password1").val(),
        password2:$(".pp_inline #password2").val(),
        email:$(".pp_inline #email").val(), // <----
    },

Running your code through a tool like JSLint would generate an error like this:

Problem at line 10 character 47: Unexpected ','.

Upvotes: 6

Related Questions