Click here to Skip to main content
15,884,388 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
GeneralRe: Redirect after execution Pin
cjoki9-Nov-10 10:57
cjoki9-Nov-10 10:57 
AnswerRe: Redirect after execution Pin
jaypatel51214-Nov-10 8:42
jaypatel51214-Nov-10 8:42 
QuestionWant to hire a code? Pin
Noman Rasheed7-Nov-10 11:22
Noman Rasheed7-Nov-10 11:22 
AnswerRe: Want to hire a code? Pin
User 17164927-Nov-10 11:38
professionalUser 17164927-Nov-10 11:38 
GeneralRe: Want to hire a code? [modified] Pin
Noman Rasheed7-Nov-10 11:41
Noman Rasheed7-Nov-10 11:41 
AnswerRe: Want to hire a code? Pin
jaypatel51214-Nov-10 8:43
jaypatel51214-Nov-10 8:43 
AnswerRe: Want to hire a code? Pin
AndyInUK1-Dec-10 0:04
AndyInUK1-Dec-10 0:04 
QuestionJSON response from PHP for ajax Pin
charlieko5-Nov-10 7:37
charlieko5-Nov-10 7:37 
I'm trying to create a php file that always returns a json as response. The problem is, it looks like it's returning a valid JSON, but jquery.ajax always says "invalid json." I copied and pasted the response and stuck it in jsonlint.com and it says it's valid json.

Can anyone point out what I'm doing wrong here? Why can't jquery (and other json parser) parse this even it's a valid json?

header('Content-type: application/json');

include("database.php");
require_once "../lib/JSON.php";

$json = new Services_JSON();

$method = strtolower($_SERVER['REQUEST_METHOD']);

$value = array();

// Open the database connection first, which will be used later.

$DB = new DBConnect();

$DB->NewConnection("localhost", "db_name", "db_role", "db_pw" );

// assume method is get here
if ($method == "get"){
    $value = getEmployees();
}

else if ($method == "post"){
}

else if ($method == "put"){
}

else {
    echo "Error - unknown http request method";
}

// tried without callback stuff but didn't work either
echo $_GET['callback'] . '(' . $json->encode($value) . ');';

AnswerRe: JSON response from PHP for ajax Pin
jaypatel5127-Nov-10 8:47
jaypatel5127-Nov-10 8:47 
AnswerRe: JSON response from PHP for ajax Pin
nickmaroulis20-Nov-10 10:00
nickmaroulis20-Nov-10 10:00 
QuestionCoverting PDF to HTML Pin
sarang_k1-Nov-10 20:48
sarang_k1-Nov-10 20:48 
AnswerRe: Coverting PDF to HTML Pin
Dr.Walt Fair, PE3-Nov-10 5:43
professionalDr.Walt Fair, PE3-Nov-10 5:43 
AnswerRe: Powershell question: How to print only the current folder name Pin
Sauro Viti27-Oct-10 0:17
professionalSauro Viti27-Oct-10 0:17 
AnswerRe: Powershell question: How to print only the current folder name Pin
Peter_in_278027-Oct-10 0:18
professionalPeter_in_278027-Oct-10 0:18 
GeneralRe: Powershell question: How to print only the current folder name Pin
melwyn27-Oct-10 0:22
melwyn27-Oct-10 0:22 
QuestionMySQL syntax error near '' Pin
nathionice25-Oct-10 21:10
nathionice25-Oct-10 21:10 
AnswerRe: MySQL syntax error near '' Pin
Geoff Williams25-Oct-10 22:28
Geoff Williams25-Oct-10 22:28 
GeneralRe: MySQL syntax error near '' Pin
Gerben Jongerius26-Oct-10 1:08
Gerben Jongerius26-Oct-10 1:08 
GeneralRe: MySQL syntax error near '' Pin
nathionice26-Oct-10 1:55
nathionice26-Oct-10 1:55 
GeneralRe: MySQL syntax error near '' Pin
Gerben Jongerius26-Oct-10 3:36
Gerben Jongerius26-Oct-10 3:36 
GeneralRe: MySQL syntax error near '' Pin
nathionice26-Oct-10 5:00
nathionice26-Oct-10 5:00 
GeneralRe: MySQL syntax error near '' Pin
Gerben Jongerius26-Oct-10 20:34
Gerben Jongerius26-Oct-10 20:34 
AnswerRe: MySQL syntax error near '' Pin
Graham Breach26-Oct-10 2:57
Graham Breach26-Oct-10 2:57 
AnswerRe: MySQL syntax error near '' Pin
cjoki26-Oct-10 5:04
cjoki26-Oct-10 5:04 
GeneralRe: MySQL syntax error near '' Pin
nathionice26-Oct-10 5:42
nathionice26-Oct-10 5:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.