I have a jquery-ajax function that sends data to a php script and the problem is with the return value, it returns the whole page instead of single value.
$("#ajaxBtn").click(function(){
var inputText = $("#testText").val();
$.ajax({ type: "POST",
url: "index.php",
data: "testAjax="+inputText,
dataType: "html",
success: function(html){
alert(html);
}
});
});
That's how it works. You're requesting index.php
via AJAX, so you'll get whatever the contents of index.php
are.
If you want a particular value, make a new PHP page that outputs just that value, and request that URL's contents instead.