Firebug: "missing } after property list"
Posted on March 3, 2011 at 6:46 PM in General, jQuery
So I was doing some "quickie" JavaScript today, using jQuery, of course. I scribbled out some code. Then I decided to change the way I was going to handle it, so I commented out little bits and changed the code. I then decided to go back to my original idea, and uncommented everything that I had previously commented out. Or so I thought.
Run the code in the browser and Firebug puked all over it with the following error message in the console:
missing } after property list
Being the incredibly awesome, mistake-free programmer I am {insert raucous laughter here}, I glanced back at my code, knowing that I would not find a mistake. And, of course, I did not - all of the brackets were in place exactly as they should be. Run the test again. Same result. Clear browser cache. Run test again. Same result. WTF?
So back to the IDE we go. Let's look closer. Like line-by-line closer. And there it was. Not a missing bracket (as the error message indicated) at all. Instead, it was a missing comma (,) between options.
- $(".myformclass").ajaxForm({
- beforeSubmit:function(){
- }
- success:function(responseText,statusText,xhr,formObj){
- // stuff here
- }
- });
See it? Right there on Line 3.
So the next time you see "missing } after property list" in the error message from Firebug, be sure to check for commas, too! :-)
Oh, and by the way, if you have not yet been introduced to Mike Alsup's form plugin, be sure to check it out here. It is a very handy plugin.
Latest Articles
- No recent entries.
Categories
- ColdBox (21) [RSS]
- ColdFusion (92) [RSS]
- Fusebox (3) [RSS]
- General (22) [RSS]
- jQuery (15) [RSS]
- Kalendar (1) [RSS]
- Linux (1) [RSS]
- Mura CMS (1) [RSS]
- Railo (1) [RSS]
- Rants (5) [RSS]
- Transfer (8) [RSS]
- Uni-Form Tag Library (36) [RSS]
Quick Links
Blogs I Read
Calendar
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
« Nov | ||||||
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Subscribe
Enter a valid email address.
On 3/3/11 at 8:20 PM, Chris said:
I had an extra comma after my }
if (element.attr("name") == "membership") {
error.appendTo("#membershipError");
}
} ,
});
See that extra comma? It was killing all IE validation. But other browsers were lenient and dismissed the comma. I guess (gag me for saying this) this is a +1 for testing in IE 7/8. (that hurt to type).
On 3/3/11 at 9:28 PM, Matt Quackenbush said:
On 3/4/11 at 8:46 AM, Brian Swartzfager said:
And +1 regarding your recommendation of Alsup's form plugin. I don't use it quite as much anymore, but it's probably the most convenient way to submit a form via AJAX.
On 6/12/11 at 2:30 PM, Kazzador_ said:
On 6/22/11 at 4:16 AM, Nicolay said:
On 7/19/11 at 4:42 PM, yard said:
On 9/8/11 at 2:23 AM, Swatej said: