Jump to content

Problem with Ajax on server


tmyonline

Recommended Posts

Hi Guys,

 

My Ajax works fine on my Window machine but when I uploaded it to the server, it failed.  Below is the code on the server:

 

<?php

class Message {

    public $messOrder;

    public $subject;

    public $content;

  }

  ...

  $message  = new Message();

  $message->messOrder = $mailRow['messOrder'];

  ...

  print(json_encode($message));

?>

 

When debugging, I saw it complain "call to the undefined function json_encode()", the last line above.  I don't get it.  It works fine on my machine though.  Any idea ?  Thanks.

Link to comment
https://forums.phpfreaks.com/topic/156114-problem-with-ajax-on-server/
Share on other sites

json_encode is available for php 5.2.0 and higher it's most likely not available because you are running a lower version of php. A work around i use is listed on the manual page and starts with

if (!function_exists('json_encode'))

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.