<?php echo 'apple'; ?>
is pretty much literally all you need on the server.
as for the JS side, the output of the server-side script is passed as a parameter to the success handler function, so you’d have
success: function(data) {
alert(data); // apple
}
More Related Contents:
- I want to use jquery nested sortable plugin with drag and drop in codeigniter using mysqli
- How do I post multiple parameters to a URL
- Can anyone help me what is wrong in this code ajax using with php? [closed]
- How do I close a connection early?
- Laravel csrf token mismatch for ajax POST Request
- Simple jQuery, PHP and JSONP example?
- Using Jquery Ajax to retrieve data from Mysql
- Update data on a page without refreshing
- Passing JavaScript array to PHP through jQuery $.ajax
- Sending JSON to PHP using ajax
- Send multiple checkbox data to PHP via jQuery ajax()
- Change DIV content using ajax, php and jQuery
- Update fee dynamically based on radio buttons in Woocommerce checkout
- Ajax File Download using Jquery, PHP
- How to load PHP file into DIV by jQuery?
- Submitting JSON data via JQuery ajax.post to PHP
- Difference between php echo and return in terms of a jQuery ajax call [closed]
- jQuery $.ajax request of dataType json will not retrieve data from PHP script
- Get variable from PHP file using JQuery/AJAX
- PHPExcel download using ajax call
- Using AJAX to pass variable to PHP and retrieve those using AJAX again
- How to pass an array using PHP & Ajax to Javascript?
- Jquery: Running AJAX locally without a webserver
- How to populate dependable drop-down using Ajax and php [closed]
- How can I pass variables from JavaScript to PHP?
- Call PHP function from jQuery?
- How to show ajax loading gif animation while the page is loading?
- Add a quantity field to Ajax add to cart button on WooCommerce shop page
- PhP Upload progress in PhP 5.4 is not working. Session variables not set
- How to Load Ajax in WordPress