Search Results

Search found 3 results on 1 pages for 'majc'.

Page 1/1 | 1 

  • Retrieve object from jquery in php script

    - by majc
    I'm trying to rebuild an object encoded with Json but i'm not getting any value. JQuery: $.post("views/insert_tasks.php",{ clickedRows : clickrows , <?php echo "tasks:'" . json_encode($tasks) . "'"; ?> }, function(data) { }); this is the PHPcode to retrieve the object: $tasks = json_decode(stripslashes($_POST['tasks']), true); $tasks is empty after execute the code above. This is what I'm getting with the $_POST['tasks']: [{"task_id":"1","description":"<p>Fazer heroi</p>","createdat":"Saturday 22nd of May 2010 11:37:37 PM","createdby":"Miguel Cardoso","max_requests":"2","max_duration":"5","job_id":"Concept Artist"},{"task_id":"2","description":"<p>teste2</p>","createdat":"Sunday 23rd of May 2010 11:23:55 AM","createdby":"Miguel Cardoso","max_requests":"2","max_duration":"5","job_id":"3D Modeller"},{"task_id":"3","description":"<p>teste3</p>","createdat":"Sunday 23rd of May 2010 11:45:39 AM","createdby":"Miguel Cardoso","max_requests":"1","max_duration":"10","job_id":"Writer"}] What I'm doing wrong?

    Read the article

  • How to pass an array of objects trough a jquery $.post?

    - by majc
    Hi, I want to pass the result of a query trough a $.post. function GetAllTasks() { $sql = "select t.id as task_id, description, createdat, createdby, max_requests, max_duration, j.name as job_name from darkfuture.tasks t, darkfuture.jobs j where t.job_id = j.id"; $sqlresult = mysql_query($sql) or die("The list of works failed: ".mysql_error($this->con)); $result = array(); while($row = mysql_fetch_assoc($sqlresult)) { $task = new TasksResult(); $task->id = $row["task_id"]; $task->description = $row["description"]; $task->createdat = $row["createdat"]; $task->createdby = $row["createdby"]; $task->max_requests = $row["max_requests"]; $task->max_duration = $row["max_duration"]; $task->job_id = $row["job_name"]; array_push($result, $task); } mysql_free_result($sqlresult); return $result; } Here is how i call it: $tasksDB = new TasksDB(); $tasks = $tasksDB->GetAllTasks(); Now i want to pass $tasks through here: $.post("views/insert_tasks.php",{'tasks[]': $tasks}, function(data) { }); I know this {'tasks[]': $tasks} it's wrong but i don't know how to do it right. Some help will be appreciated. Thanks in advance!

    Read the article

1