• I have event-func.php which I place at the root(/) of my dir installation. This file contains function get-all() {} which returns a json encode string.
    I am requesting this from the events-list-manager.php under using this ajax script at the top page.

    jQuery.ajax({
    			type: "POST",
    			url: "event-func.php",
    			action: "get-all-a",
    			dataType: "jsonp",
    			data: {event: "Hi"},
    			cache: false,
    			success: function(dataa) {
    				jQuery("#eventDetails").html(dataa);
    			},
    			error: function(resultt, statut, error_) {
    				jQuery("#eventDetails").html(error_);
    			}
    		});

    This is the content of get-all():

    <?php
    
    add_action( 'wp_ajax_nopriv_get-all-a', 'get-all' );
    
    function get-all() {
     echo json_encode("Test OK!");
    }
    ?>

    But I am getting an Intenal Error 500 . How can I solve this issue ?

The topic ‘Ajax : Call external PHP file’ is closed to new replies.