1

i'm generating this code

$.ajax({
        url: '/orders/modify/action/',
        type: "POST",
        dataType: 'json',
        data: 'id='+10+
              '&commento='+$('#shop_order_status_history_comments').val()+
              '&id_status='+$('#shop_order_status_history_orders_status_id').val()+
              '&notify_client='+$('#shop_order_status_history_notify_client').val()+
              '&local_part_email='+j.garpe+   // the error goes here
              '&domain_email='+domain.com,
        success:function(data){

But I'm getting this error:

"Uncaught referenceError: j is not defined".

The code is this:

      ...  
      '&local_part_email='+<?php echo $local_part_email?>+
      ...

Any help?

Regards

Javi

1 Answer 1

2

It needs to be in quotes, like this:

'&local_part_email=<?php echo $local_part_email?>'+

...but you'll have the same problem with domain next, it's best to put it in quotes and let jQuery create the string, by passing an object to data like this:

data: {id: 10,
       commento: $('#shop_order_status_history_comments').val(),
       id_status: $('#shop_order_status_history_orders_status_id').val(),
       notify_client: $('#shop_order_status_history_notify_client').val(),
       local_part_email: '<?php echo $local_part_email?>',
       domain_email: '<?php echo $whatever_domain_variable_here?>' }
Sign up to request clarification or add additional context in comments.

Comments

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.