Hi Gimantha,

It worked. Thanks a lot.

-Cheers

On Thu, Feb 26, 2015 at 5:35 PM, Gimantha Bandara <[email protected]> wrote:

> Hi Fawsan,
>
> Use JSON.Stringify on the data object submitted with POST.
>
> On Thu, Feb 26, 2015 at 4:04 PM, Mohammed Fawsan <[email protected]> wrote:
>
>> CORRECTION : The JS function looks like this.
>>
>> $(function(){
>>     $("#loginform").submit(function(e){
>>
>>         e.preventDefault();
>> //      var data = $("#loginform").serialize();
>>
>>             var data =  {"username" : $("#username").val(),"password" : 
>> $("#password").val()};
>>
>>         alert(JSON.stringify(data));
>>
>>         $.ajax({
>>             type: "POST",
>>             url: 
>> "http://10.100.4.135:9763/dashboardConfigs/dashBoardConfigs/login ",
>>             data: data,
>>
>>             contentType: "application/json",
>>             crossDomain : true,
>>             dataType: "json",
>>             success: function(data) {
>>
>>                 alert("success" + JSON.stringify(data));
>>
>>             },
>>             error:function(data){
>>                 alert('error : '+JSON.stringify(data));
>>             }
>>
>>         });
>>
>>     });});
>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Gimantha Bandara
> Software Engineer
> WSO2. Inc : http://wso2.com
> Mobile : +94714961919
>



-- 
Mohammed Fawsan
Software Engineering Intern,
Faculty of Engineering, University of Peradeniya.
+94771121195
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to