-1

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>
    <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.

1 Answer 1

2

funtion -> function in line 5. also to go to the root of your site i would use window.location = window.location.host

Sign up to request clarification or add additional context in comments.

1 Comment

Oops! $('#addItem').click(funtion(){ => $('#addItem').click(function () {. The reason for the URL is to switch to a different visual studio project.

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.