PDA

View Full Version : Problem with Ext.util.JSONP.request



Shariar Shaikot
14 Dec 2011, 6:32 AM
Hello,
I am seeking help from the experts.
Here is codes


function showProfile(pid)
{
Ext.getBody().mask('Loading...', 'x-mask-loading', false);
Ext.util.JSONP.request({
url: 'http://cellbuddy.mobi/view_profile.php?pid='+pid,
callbackKey: 'callback',
callback: function(guests) {

var guests = pro.guests;
if (guests) {

var html = tpl.applyTemplate(guests);
Ext.getCmp('profileOne').update(html);
Ext.getCmp('profileOne').setTitle('You tapped a profile');
Ext.getCmp('profileOne').setInstructions('If you like this profile then please confirm.');
Ext.getCmp('Lotto').setHTML('Allo');
}else{


Ext.getCmp('bottom').setTitle('Wrong profile selected');

}
Ext.getBody().unmask();
}
});
}





<?php
session_start();
$dsn = 'mysql:dbname=touche;host=localhost';
$user = 'root';
$password = 'result44';
try {
$callback = $_REQUEST['callback'];
$dbh = new PDO($dsn, $user, $password);
if(isset($_REQUEST['pid']))
{
$profileid = $_REQUEST['pid'];

$_SESSION['pid'] = $profileid;

$sql = "SELECT * FROM predifind_profiles WHERE profileid='".$profileid."'";


foreach($dbh->query($sql) as $row)

{
$guests[] = array('name' => $row['name'], 'descricption' => $row['description']);
}
if ($callback) {
header('Content-Type: text/javascript');
echo $callback . '(' . json_encode(array('guests' => $guests)) . ');';
} else {
header('Content-Type: application/x-json');
echo json_encode(array('guests' => $guests));
}




}


} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}

?>









When I call the showProfile function to display profile details then the page keep loading and loading.
Nothing returns.

Shariar Shaikot
14 Dec 2011, 6:39 AM
I also facing same problem when I am trying to submit a cross domain form.
I mean I also can not connect to the mySQL server when the javascript files was package up for an android app with phonegap.


Please help me..... I lost too many days for those problems.