I have a little problem with ajax and passing POST data from jquery to PHP, and then writing back returned value from php to div tag
This is the code:
JS
function jsAjax()
{
$.ajax(
{
type:"POST",
url:"http://localhost/anonsecrets/functions/jswrapper.php",
data:{name:"Ilija", phone:"0343014"},
success:function(data)
{
$("#msg").html(data);
},
error:function()
{
alert("Neuspenos");
}
});
};
PHP
<?php
echo $_POST['name'];
?>
And HTML
<div id="msg"></div>
<a href="" target="" onclick="jsAjax()"><div id="headerbutton">Best</div></a>