AnsweredAssumed Answered

How to login to rest services with javascript

Question asked by ismail_codar on Oct 11, 2011
Latest reply on Apr 22, 2012 by mak10
I'am using jquery. I can not run the following code.
Returns 405 Method Not Allowed http error.
If you remove line of the contentType: "application/json; charset=utf-8"  returns 415 Unsupported Media Type.

<html>
<head>
   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
   <script type="text/javascript">
   $(document).ready(function(){
   
   $.ajax({
     type: "POST",
     url: "http://localhost:8080/activiti-rest/service/login",
     dataType: "json",
     contentType: "application/json; charset=utf-8",
     data: {
      "userId": "kermit",
      "password": "kermit"
      },
     success: function(json) {
      alert(json.success);
      }
   });

   });
   </script>
</head>
<body>
</body>
</html>

Outcomes