What is wrong with my javascript code?
I am creating a simple tester page to test some other functions within my website. I can't get it to run. What am I doing wrong?
<p>开发者_如何学C;
<a href="#" id="addItem">Add item to cart</a>
</p>
<script>
$('#addItem').click(funtion(){ /* Expected '(' or ',' */
$.post('http://localhost:1969/AddToCart',
'SystemCodeId=WB&SystemKey1=123456&SystemKey2=123ABC&Cost=25.01&TransactionType=1&Description=This is a test',
function (data) {
document.location.replace('http://localhost:1969/');
});
}); /* Expected expressions */
</script>
Visual Studio keeps thinking there is a syntax error. I don't doubt it, but I can't figure out where the problem is. The comments are the errors that visual studio is reporting.
Firebug won't recognize the script either (doesn't show in the scripts tab). So I know there is a problem some where.
Note: I am using HTML5.
funtion
-> function
in line 5. also to go to the root of your site i would use window.location = window.location.host
精彩评论