I am trying to call a jquery script that will post data to a PHP form. Been googling this for 5h now but i cant seems to solve it on my own. The Script looks like this.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script language="JavaScript" type="text/javascript">
function postscrape(igid, iguser, groupid) {
alert(igid);
$.post("scrapeadder.php", {
instagramid: igid,
username: iguser,
groupid: groupid
},
function(data, status) {
alert("Data: " + data + "\nStatus: " + status);
});
};
</script>
And my HTML/PHP code to call this function looks like:
echo '<td><button type="button" class="btn btn-success datascraper" name="addscrape" id="addscrape" onclick="postscrape('.$row["instagram_id"].', '.$row["user_name"].', 1);">Add to Scrape</button></td>';
The error i get is: Uncaught ReferenceError: X is not defined
Where X = The iguser (which gets from $row["user_name"] If i check the HTML code on the homepage it list all the $rows correct. So my guess is i messed up in the function.
You need to put the user name in quotes.