Hi, I am new to JSON .My question is how to pass JSON data to restful web services through ajax?
Please Help me.
I tried by following code but I am not sure about it
MY INDEX PAGE
<script type="text/javascript">
$(document).ready(function(){
var uname = document.getElementById("uname").value();
var password = document.getElementById("pwd").value();
$('#ok').click(function(){
$.ajax({
url:'http://localhost:8090/LoginAuthRWS/rest/orders',
type:'post',
dataType: 'Jsondemo',
success: function(data) {
$('#name').val(data.name);
$('#email').val(data.email);
var JSONObject= {
"uname":uname,
"password":password
};
}
});
});
});
</script>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…