Click here to Skip to main content
15,881,821 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
is this true way to pass last argument by references
this code always return fail
JavaScript
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type = "text/javascript">
$(document).ready(function(){

        $("#login").click(function () {
var ret_data = "g";
alert("here");
 var html = "";
            $.ajax({
                type: "post",
                contentType: "application/json; charset=utf-8",
                url: 'http://10.19.193.74/unmswebservice/fcc.asmx/AuthenticateUser',
                data: {Username: '+ $("#prefix").val() +',Password: '+$("#pass").val()+',AuthenticatedToken: '+ret_data+' },
                processData: true,
                dataType: "json",
                success: function (response) {
                    var customers = eval(response.d);
alert(ret_data);

                    $("#results").html(html == "" ? "No results" : html);
                },
                error: function (a, b, c) {
                     alert("FF");

                   // alert(a.responseText);
                }
            });
        });
});
    </script>
</head>
<body>
    <form id="form1" action="http://10.19.193.74/unmswebservice/fcc.asmx" method="post">
   <span>user name</span> <input type ="text" id = "prefix" /> <br/>

    <span>password</span>   <input type="text",id="pass"/> <br/>

    <input id = "login" type = "button" value = "Search" />

    <div id = "results"></div>

    </form>
</body>
</html>
Posted
Updated 30-Oct-14 4:39am
v3

1 solution

remove below part from form tag and try

"action="http://10.19.193.74/unmswebservice/fcc.asmx" method="post""

if you are making ajax request which is not hosted on same server you will have to use jsonp as datatype

dataType: "jsonp"
 
Share this answer
 
Comments
Mahmoud_Gamal 3-Nov-14 7:53am    
not work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900