jQuery should this really be considered a hardcoded value?

Viewed 607

I'm looking at the following jQuery call:

$.get('/Home/GetResult', null, function (data) {

    alert(data);

});

I see this being called the 'Hard Coded' way of doing this compared to:

$.get('@Url.Action("GetResult", "Home")', function (data) { 

    alert(data);

});

which I see referred to as the non hard coded way of doing this.

Could someone please explain to me what this is all about? Seems to me both ways are equally hardcoded ways of calling this because you have the explicit names of the Controller and Method in both.

Does anyone know why one is called hardcoded and the other isn't. Is one better?

5 Answers
Related