views:

38

answers:

3

Error: invalid regular expression flag b Source File: http://localhost/media/javascript/global.js Line: 4, Column: 19 Source Code: url: /home/blog,

$("#blog").click(function () {
var url = $(this).attr("href");
$.ajax ({
    url: /home/blog,
    type: "POST",
    success : function (html) {
        $("#someDiv").append(html);
    }
});

});

I cant figure out what the error is, does my URL need to be in a string? What am I missing?

+2  A: 

You want the url to be "home/blog"

Claudiu
A: 

Im not a Javascript Guru, but from that sample, I would of thought that you need to put the URL in quotes, so it should read:

url: "/home/blog",
Wil
A: 

You haven't put your url in quotes.

url: "home/blog",

When you're looking at the errors returned, make note of the column and line numbers - they can really help and give a massive indication to where you may have gone wrong.

Daniel May