WordPress database error: [Table './ay6u3nor6dat6ba1/kn6_ayu1n9k4_5_actionscheduler_actions' is marked as crashed and last (automatic?) repair failed]
SELECT a.action_id FROM kn6_ayu1n9k4_5_actionscheduler_actions a WHERE 1=1 AND a.hook='aioseo_send_usage_data' AND a.status IN ('in-progress') ORDER BY a.scheduled_date_gmt ASC LIMIT 0, 1

WordPress database error: [Table './ay6u3nor6dat6ba1/kn6_ayu1n9k4_5_actionscheduler_actions' is marked as crashed and last (automatic?) repair failed]
SELECT a.action_id FROM kn6_ayu1n9k4_5_actionscheduler_actions a WHERE 1=1 AND a.hook='aioseo_send_usage_data' AND a.status IN ('pending') ORDER BY a.scheduled_date_gmt ASC LIMIT 0, 1

Return JSON data from PHP | Loop and Break

Return JSON data from PHP

Here we will use ajax function of JQuery to call PHP script and this PHP script will generate a simple JSON data. This JSON data will return to JavaScript method. Then we will parse returned data using JavaScript.
We are creating only two files first is index.php which contains jquery and html and then the request is sent to test.php

index.php (code)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>json</title>

<script
	src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
jQuery(document).ready(function($) {

	$("#testButton").click(function(e) {
                $.ajax({url:"test.php",
                       type: "POST",
                       dataType:"JSON",
                       scriptCharset: "UTF-8",
                       success:function(result){
                           alert(result[0].result2);
				}
         });
	});
 
});
</script>
</head>

<body>

	<button type="button" id="testButton">Click me</button>

</body>
</html>

test.php

<?php
$rows[] = array("result" => 'This is JSON data',
				"result2" => 'this is result 2',
				"result3" => 'this is result 3'
);
$json = json_encode($rows);
echo $json;
?>

Output

Untitled

Share

You may also like...