appAPI.ready(function($) {
var data1 = "Mydata1";
var data2 = "Mydata2";
appAPI.browserAction.onClick(function() {
appAPI.request.post({
url: 'http://www.example.com/Ext.php',
postData: 'data1='+ data1 +'&data2='+ data2,
onSuccess: function(response) {
alert("Succeeded in posting data");
//alert(response);
},
onFailure: function(httpCode) {
alert('in posting data. (HTTP Code:' + httpCode + ')');
},
additionalRequestHeaders: {
myHeader: 'value'
},
// contentType: 'application/json'
contentType: 'application/x-www-form-urlencoded'
});
}); });
Then, in the Ext.php file grab the post data using $_POST["data1"] and $_POST["data2"]
Sample code for $_POST[]: http://www.w3schools.com/php/php_post.asp