Visual Studio caught this error when running MVC music store:
Microsoft JScript runtime error: '$' undefined
In this sectionCodeHighlighted
(Function () {$
// Document. Ready-> remove event processingProgramConnection
$ (".Removelink ") Author (function (){
// Obtain the ID from the link
VaR recordtodelete = $ (this). ATTR ("data-ID ");
If (recordtodelete! = '){
// execute Ajax sending
$. post ("/shoppingcart/removefromcart", {"ID": recordtodelete},
function (data) {
// a successful request
// updated page element
If (data. itemcount = 0) {
$ ('# Row-' + data. deleteid ). fadeout ('low ');
}other {
$ ('# item-count-' + data. deleteid) to (data. ) itemcount ;
}
$ ('# Cart-total'). Text (data.Carttotal );
$ ('# Update-message'). Text (data.Chaotic age );
$ ('# Cart-status'). Text ('shopping cart' + data.Cartcount + ')');
});
}
});
});
Solution:
Make sure that the script in/views/shared/_ layout. cshtml references the matching jquery in the/scripts folder, probably the/scripts/jquery-1.5.1.min.js version (The jquery file version in the/scripts folder prevails.).