{"action":"closed","issue":{"url":"https://api.github.com/repos/simple-mvc-framework/framework/issues/162","labels_url":"https://api.github.com/repos/simple-mvc-framework/framework/issues/162/labels{/name}","comments_url":"https://api.github.com/repos/simple-mvc-framework/framework/issues/162/comments","events_url":"https://api.github.com/repos/simple-mvc-framework/framework/issues/162/events","html_url":"https://github.com/simple-mvc-framework/framework/issues/162","id":96681763,"number":162,"title":"Request helper","user":{"login":"jimgwhit","id":7936192,"avatar_url":"https://avatars.githubusercontent.com/u/7936192?v=3","gravatar_id":"","url":"https://api.github.com/users/jimgwhit","html_url":"https://github.com/jimgwhit","followers_url":"https://api.github.com/users/jimgwhit/followers","following_url":"https://api.github.com/users/jimgwhit/following{/other_user}","gists_url":"https://api.github.com/users/jimgwhit/gists{/gist_id}","starred_url":"https://api.github.com/users/jimgwhit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimgwhit/subscriptions","organizations_url":"https://api.github.com/users/jimgwhit/orgs","repos_url":"https://api.github.com/users/jimgwhit/repos","events_url":"https://api.github.com/users/jimgwhit/events{/privacy}","received_events_url":"https://api.github.com/users/jimgwhit/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-07-22T22:34:19Z","updated_at":"2015-07-23T20:24:36Z","closed_at":"2015-07-23T20:24:36Z","body":"Sorry I didn't know where else to put this. In the Request helper I am only confused in the Request::isAjax() part. The post and get I have no questions.  I had this code prior which is an ajax request to return some data:\r\n~~~\r\npublic function getowner()\r\n    {\r\n        $this->chkLog(); \r\n            $ownerid = $_GET['id'];\r\n            $data['oList'] = $this->Owner->getownerList2($ownerid);\r\n\r\n            foreach ($data['oList'] as $row) {\r\n\r\n                $idnew = $row->ownerid;\r\n                $petowner = $row->oname;\r\n                $ostreet = $row->ostreet;\r\n                $odate = $row->odate;\r\n                $ocheck = $row->ocheck;\r\n           }\r\n            $return_value = $idnew . \"|\" . $petowner . \"|\" . $ostreet . \"|\" . $odate . \"|\" . $ocheck;\r\n            echo $return_value;\r\n       }\r\n~~~\r\nNow using the new Request helper is the below new code correct?\r\n~~~\r\npublic function getowner()\r\n    {\r\n        $this->chkLog();\r\n        if (Request::isAjax() == TRUE) {\r\n            $ownerid = $_GET['id'];\r\n            $data['oList'] = $this->Owner->getownerList2($ownerid);\r\n            foreach ($data['oList'] as $row) {\r\n                $idnew = $row->ownerid;\r\n                $petowner = $row->oname;\r\n                $ostreet = $row->ostreet;\r\n                $odate = $row->odate;\r\n                $ocheck = $row->ocheck;\r\n            }\r\n            $return_value = $idnew . \"|\" . $petowner . \"|\" . $ostreet . \"|\" . $odate . \"|\" . $ocheck;\r\n            echo $return_value;\r\n        } else {\r\n            echo \"no work or what goes here\";\r\n        }\r\n    }\r\n~~~\r\nAm I using it correctly or not?  If not can you give a detailed example to correct my code?  \r\n  \r\nThe jquery that does the request to this controller method is:\r\n~~~\r\n $(function () {\r\n\r\n        $(\"#myTable td:nth-child(1)\").click(function (event)\r\n        {\r\n            event.preventDefault();\r\n            var $td = $(this).closest('tr').children('td');\r\n            var currentCellText = $td.eq(0).text();\r\n            var CellText = $td.eq(1).text();\r\n\r\n            $.ajax({\r\n                url: '<?php echo DIR . \"owner/getowner\"; ?>',\r\n                type: 'GET',\r\n                data: 'id=' + currentCellText,\r\n                success: function (data) {\r\n                    var mystr = data.split(\"|\");\r\n                    window.opener.$('#ownerid').val(mystr[0]);\r\n                    window.opener.$('#petowner').val(mystr[1]);\r\n                    window.opener.$('#ostreet').val(mystr[2]);\r\n                    window.opener.$('#odate').val(mystr[3]);\r\n                    if (mystr[4] == '1')\r\n                    {\r\n                       window.opener.$('#ocheck').attr('checked', true);\r\n                    }\r\n                    else\r\n                    {\r\n                      window.opener.$('#ocheck').attr('checked', false);\r\n                    }\r\n       \r\n\r\n                    self.close();\r\n                }\r\n            });\r\n        });\r\n~~~\r\nAny help would be appreciated, I want to understand the isAjax part and how to correctly use it.\r\n"}}