The error says it all, you are sending the request to a invalid host.
Change this:
var ajaxurl="http://my-site.co.uk <?php bloginfo("wpurl");?>/wp-admin/admin-ajax.php";
To:
var ajaxurl = "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ) ?>";
Note: from your code and description I’m assuming you are generating the jQuery code within PHP and it is not in a js file.
Additionally, you must die/exit the program after after the ajax response is sent out (this is not done automatically and the request could be open forever, see documentation):
echo $response;
// Terminate
exit;
And more wrong things I see in your code: you are saying to jQuery to work with JSONP data but your ajax response is a HTML string. You should remove this line or change it to the correct data type:
dataType: 'jsonp',
After the edition of the question, you have introduced a new problem. You are trying to asign the_content()
to the value of $response
but the_content()
prints the post content, it doesn’t return any value. If you want to get the value of the post content you should use get_the_content() instead and to get the same result as the_content
you should apply the_content
filters. Change this:
$response .= '<p>'. the_content().'</p>';
To:
// <p> are not need because the the_content filters include wpautop()
$response .= apply_filters( 'the_content', get_the_content() );