I want to pass some values from JavaScript to PHP using jQuery/AJAX. I have the following \"simplified\" code, not sure what is that I am doing wrong. There seems to be quit
You need to include a success handler in your AJAX call:
$("#text-id").on( 'click', function () {
$.ajax({
type: 'post',
url: 'text.php',
data: {
source1: "some text",
source2: "some text 2"
},
success: function( data ) {
console.log( data );
}
});
});
and in your console, you'll receive:
some textsome text 2
Do make sure that both the test.php and your html source files are in same directory.