/** * authentication */ $(function(){ //dologin $("#login_submit").click(function(){ var username = $("#username").val(); var password = $("#password").val(); if(username == "" || password == ""){ alert("Invalid UserName or Password."); }else{ //call resetful api var endpoint = "http://localhost:8080/alfresco/service/api/login?u=" + username + "&pw=" + password + "&format=json"; alert(endpoint); $.ajax({ type: "GET", headers: { "Content-Type": "application/json" }, url: endpoint, //contentType: "application/json", processData: false, //data: stringData, dataType: "jsonp", jsonp:"alf_callback", jsonpCallback:"jsonp_callback_login", statusCode: { 404: function() { alert('page not found'); }, 400: function() { alert('bad request'); } } }); } }); }); function jsonp_callback_login(data){ alert(data.data.ticket); }
星期一, 4月 18, 2011
[Alfresco] login using Jquery
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言
留個話吧:)