0

I have the following code which returns a syntax error on line 2 sales.js:2SyntaxError: Expected token ')' What's wrong with that?

$('<div id="new_contact_dialog"></div>')
.html('<%= escape_javascript render(:partial => 'choose_storage.html.erb') %>')
.dialog({
    autoOpen: true,
    modal: true,
    title: 'Add a Contact%>',
    buttons: { 'Create Contact' :  function(){ $(this).find("form").submit(); }, 'Cancel' : function(){ $(this).dialog("close"); } },
    show: "fade",
    hide: "fade",
    width: 420
});

1 Answer 1

1

You have an extra %> in your title: 'Add a Contact' line, which may be making the actual rendered JS screwy, since you're using ERB. I'd recommending inspecting the output of the view in the actual browser; that may help reveal what's going wrong with it.

Other than that, the JS looks like it parses out correctly. I used http://jsbeautifier.org/ to check it out, which makes finding parentheses issues a bit easier to track down.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.