adminLogin_parameter = {}; function adminLogin_init() { $('#content').html(''); $('#result').html(''); var str = ''; str += ''; str += ''; str += ''; str += '
post
credential:
password:
'; $('#content').html(str); $('#post').click(function() { adminLogin_login(); }); } function adminLogin_login() { $('#result').html(''); $.ajax({ type : 'post', dataType : 'json', url : '../jaxrs/adminlogin', contentType : 'application/json; charset=utf-8', data : JSON.stringify({ name : $('#name').val(), credential : $('#credential').val(), password : $('#password').val() }), xhrFields : { 'withCredentials' : true }, crossDomain : true }).done(function(json) { $('#result').html(JSON.stringify(json, null, 4)); }); }