Im trying to bebug some javascript in firefox and I keep getting this error.
SyntaxError: syntax error

data: {action: addtocart, id: <br />

the javascript is this:

<script type="text/javascript">
        $('#button').on('click', function(e){

                url: 'shopping2/includes/functions.php',
                type: 'POST',
                 data: {action: addtocart, id: <?php echo $pid; ?> },
                cache: false,
                success: function(data){

where is the error?

Chrome tells me it is the < on line ten, where you are tring to insert some php.
that line
data: {action: addtocart, id: <?php echo $pid; ?> },

If your PHP was being compiled correctly this wouldn't be visible to the browser so I'm gueesing that isn't the problem.
But from the error you gave, it still the < that is causing the problem. What should $pid be?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.