您需要在AJAX调用中包含成功处理程序:
$("#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 ); } });});在控制台中,您将收到:
some textsome text 2
请确保
test.php和您的html源文件都在同一目录中。



