{"action":"closed","issue":{"url":"https://api.github.com/repos/bramus/router/issues/87","repository_url":"https://api.github.com/repos/bramus/router","labels_url":"https://api.github.com/repos/bramus/router/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/bramus/router/issues/87/comments","events_url":"https://api.github.com/repos/bramus/router/issues/87/events","html_url":"https://github.com/bramus/router/issues/87","id":417899612,"node_id":"MDU6SXNzdWU0MTc4OTk2MTI=","number":87,"title":"Post route returning random html with echo in ajax request","user":{"login":"xeon826","id":5651215,"node_id":"MDQ6VXNlcjU2NTEyMTU=","avatar_url":"https://avatars3.githubusercontent.com/u/5651215?v=4","gravatar_id":"","url":"https://api.github.com/users/xeon826","html_url":"https://github.com/xeon826","followers_url":"https://api.github.com/users/xeon826/followers","following_url":"https://api.github.com/users/xeon826/following{/other_user}","gists_url":"https://api.github.com/users/xeon826/gists{/gist_id}","starred_url":"https://api.github.com/users/xeon826/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xeon826/subscriptions","organizations_url":"https://api.github.com/users/xeon826/orgs","repos_url":"https://api.github.com/users/xeon826/repos","events_url":"https://api.github.com/users/xeon826/events{/privacy}","received_events_url":"https://api.github.com/users/xeon826/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-03-06T16:36:31Z","updated_at":"2019-03-06T18:16:59Z","closed_at":"2019-03-06T18:16:59Z","author_association":"NONE","body":"```\r\nfunction checkPin() {\r\n  $('#add-new-user #user_pin').keyup(function(e) {\r\n    if ($(this).val().length >= 1) {\r\n      $('.pin-alert').removeClass('hidden');\r\n      $.ajax({\r\n        type: 'POST',\r\n        url: '/findPin',\r\n        data: ({\r\n          user_pin: $('#user_pin').val()\r\n        }),\r\n        success: function(response) {\r\n          console.log(response);\r\n          if (response == 1) {\r\n            $('.pin-alert').text('This pin is already in use!').removeClass('alert-success').addClass('alert-danger');\r\n          } else {\r\n            $('.pin-alert').text('This pin is available!').removeClass('alert-danger').addClass('alert-success');\r\n          }\r\n        },\r\n        error: function(request, status, error) {\r\n          console.log(request.reponseText);\r\n        }\r\n      });\r\n    }\r\n  })\r\n}\r\n\r\n```\r\nMy js function \r\n```\r\n    public function checkPinAction()\r\n    {\r\n        $this->db->where('user_pin', $this->data['user_pin']);\r\n        $users = $this->db->get('tblusers');\r\n        echo sizeof($users) ? '1' : '0';\r\n    }\r\n\r\n```\r\nController method\r\n`$router->post('/findPin', 'UserController@checkPinAction');`\r\nAnd my route.\r\n\r\nIt returns 1 or 0 as expected but then it also returns several html closing tags, I'm not sure what's causing this, I'm loading twig in the parent class of the controller, maybe it's an error with that? I'm using PHP 5.4.2"}}
{"actor":{"display_login":"xeon826"}}