I am designing a project in phonegap with android. i want to show the name using alert message in phonegap which is returned by my php class. This is my php class:
<?php
final class DataStrip
{
public function DataStrip()
{
return "kuntal";
}
}
?>
Now in my phonegap program i want to display this "kuntal" by using alert. please help me what will be code to do 开发者_JS百科this functionality in phonegap. please check my php class also.
Have your php return a JSON object:
final class DataStrip
{
public function DataStrip()
{
return json_encode(array("result"=>"kuntal"));
}
}
?>
Then in your PhoneGap application, use ajax to get the JSON and alert it (example uses jQuery for brevity):
$.getJSON('http://www.domain.com/mypage.php', function(data) {
alert(data.result);
});
精彩评论