Nass12 Posted October 26, 2018 Share Posted October 26, 2018 Hi, new to this forum and got an issue here: I am getting a console error of a syntax error from the browser (chrome) console: var dataString='lookupId='+<?php echo $_GET['lookupId']; ?>; //Uncaught SyntaxError: Unexpected token ; var dataPlusLookID = dataString+lookId; var country_dest_id=""; $.ajax({ type : 'GET', url : 'https://www.example.co.uk/files/viator/ajax_statelist_left.php', data : dataString, dataType : 'json', success : function(data) { $("#currency_code").val(data.currency_code); $("#country_name").val(data.country_name_without_design); $("#country_dest_id").val(data.country_dest_id); country_dest_id=data.country_dest_id; } }); function searchadventurelist(path){ location.href=path+'&country_dest_id='+country_dest_id+'&lookupId=<?php echo $lookupId;?>'; } Appreciate the help Link to comment Share on other sites More sharing options...
Barand Posted October 26, 2018 Share Posted October 26, 2018 Post the code (in code frames using <> button) and not pictures of your code. Link to comment Share on other sites More sharing options...
requinix Posted October 26, 2018 Share Posted October 26, 2018 That's your PHP code, but this is not a PHP error. It's a Javascript error. What is the Javascript code actually on the page? Link to comment Share on other sites More sharing options...
Barand Posted October 26, 2018 Share Posted October 26, 2018 4 hours ago, Nass12 said: var dataString='lookupId='+<?php echo $_GET['lookupId']; ?>; Consider how that line of code will look if there is nothing in $_GET['lookupId'] Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.