Mujahid
Mujahid

Reputation: 1237

JQuery Week Calendar Issue

In my project, I am using the JQuery week calendar plugin. I call a php script to retrieve the data and show it in the calandar. Following is my code

var id = 3; 
     var type = "c";
     var dataString = "id=" + id + "&t=" + type;
     $.ajax({
        type:"post",
        url:"actions/client.php",
        data: dataString,
        dataType:"json",
        success: function(data){
            alert(data);
        }
    }); 

In PHP:

function getCalendarData($appoint_id){
                $retunArray = array();
                $sql = "SELECT id, appoint_start, appoint_end, total FROM account WHERE id = '".$appoint_id."'";
                $result = mysql_query($sql);
                while($row = mysql_fetch_object($result)){
                    $retunArray[] == $row;  
                }
                echo json_encode($retunArray);
            }

It gives me a 500 error. Has anyone used it before with PHP. Can anybody help me to get the data from the db and show? any alternative good way than this

Thanks

Upvotes: 0

Views: 1104

Answers (1)

Otto
Otto

Reputation: 4200

Check the response in your browser. If you use G. Chrome press F12, click in Network tab and in the bottom click on XHR. Click in the response to expand the information

Maybe you are gzipping the JSON data, are you using any php framework?

Upvotes: 1

Related Questions