I have some json data existed in a php file that needs to be posted to a url by using javascript. But i dont know Howto?
$param_fields = array(
'format'=> 'json',
'event'=> 'revert',
'api_key' => '23423'
);
$encoded_params = json_encode($param_fields); \\$encoded_params should be posted
$url = "www.example.com/lt"
I hope through clicking a button to post the json data mentioned above, e.g.
echo "<input type='button' value='post json' onclick= 'post_json_data($url, $encoded_params)'>"
You can use
jQuery.get()if you want simplicity.example:
or check this if you only want to use javascript : http://www.webreference.com/programming/javascript/kh/column2/