0
function GenerateTermSheet()
        {
            var urlString = <%= System.Web.VirtualPathUtility.ToAbsolute("~/mvc/Indications.cfc/CreateTermSheet/")%>
            var guidString = GetGUIDValue();
            alert(urlString);
//            $.ajax({
//                    type: "POST",
//                    url: urlString,
//                    success: function(data) {
//                        alert('Success!');
//                    }
//                });
        }

When I use firebug...I can see that it applies the correct path to urlString, however it returns this error at that line?

invalid regular expression flag v
[Break On This Error] var urlString = /Extranet/mvc/Indications.cfc/CreateTermSheet/ 

What could this be?

1
  • 1
    have you tried using quotatoin around the .net output? Commented Feb 10, 2011 at 18:33

1 Answer 1

3

You have to enclose the inserted text with quotations marks:

var urlString = '<%= System.Web.VirtualPathUtility.ToAbsolute("~/mvc/Indications.cfc/CreateTermSheet/")%>';

Otherwise the text is interpreted as JavaScript and one way of defining regular expressions is with /.../. So /Extranet/ is recognized as regular expression and everything after that is treated as modifiers (or flags) . m is a valid modifier, but v isn't and there it errors.

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.