什么时候我运行托管项目服务运行完美..
当我测试其他项目给我错误或我无法得到服务的响应.我尝试了很多但没有工作
我的Ajax电话:
self.ValidLogin = function () { try { $.ajax({ type: "GET", url: "http://xxx.xxx.xxx.xxx/TEST/index.php/TestController/TestMethod?UserName=superadmin&Password=super", , crossDomain: true, contentType: "application/json; charset=utf-8", async: false, dataType: 'json', cache: false, success: function (response) { alert("valid response"); }, error: function (ErrorResponse) { alert("error"); } }); } catch (error) { alert("Catch:" + error); } }
服务方面:
public function TestMethod() { parse_str($_SERVER['QUERY_STRING'],$_GET); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $this->load->model('LoginModel'); $result = $this->LoginModel->Login($UserName,$Password); header('Content-type: application/json'); header('Access-Control-Allow-Origin: *'); echo json_encode($result); }
我该怎么办?