HI im trying to send a jquery post/ajax to send some variables to a php file.
<script src="/jquery.js"></script>
<script type="text/javascript">
var music ='';
var genre ='';
var language ='';
var nasheedid = "<? echo $postid; ?>";
var session = "<? echo $_SESSION['SESS_TMP']; ?>";
$(function(){
$('.submit').click(function(){
var postdata = {pmusic: music, pgenre: genre, plang: language, psession: session};
$.ajax({
type: 'post',
cache: false,
url: 'addmusic.php',
data: postdata,
success: function (msg) {
alert(msg);
},
dataType: "text",
});
});
});
now regardless of where i post the stuff to, (even if i change the url to url: blahblah.php123 I still get the same results (which is):
The alert displays the entire source code of the file (that the above code is on)
thanks guys i fixed the problem myself. My server was using rewrite so i had to use
url: "/addmusic.php"instead ofurl: "addmusic.php".