Ajax JS error

Alex Lord
Alex Lord used Ask the Experts™
on
Screen-Shot-2018-10-29-at-11.10.05.png

              $(document).on('click', '#action-unSub', function(){
        $.ajax({
            url: "unsubscribe-manual.php",
            type: "POST",
            data: { email:<?=$v_item['CONTACT_EMAIL'];?> },
            success: function(html){
            
             
            },
            error: function(html){
               
            }
        });
    });

Open in new window


what is the issue ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
Put quotes around your data

              $(document).on('click', '#action-unSub', function(){
        $.ajax({
            url: "unsubscribe-manual.php",
            type: "POST",
            data: { email:"<?=$v_item['CONTACT_EMAIL'];?>" }, // <==== NOTE THE QUOTES
            success: function(html){
            
             
            },
            error: function(html){
               
            }
        });
    });

Open in new window

Your script output is sending string data to the value of a property without enclosing it in quotes.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial