1 | <body> <form> Name:<input type= "text" id= "txt" > <input type= "button" value= "提交" onclick= "A()" > </form> </body> <script> function A() { $.ajax({ url: 'b.php' , type: 'post' , dateType: 'json' , data: {name: $( "#txt" ).val()}, success: function (result) { alert(result.password);
|
登入後複製
回复讨论(解决方案)
1 | var result = jQuery.parseJSON(result); alert(result.password);
|
登入後複製
先alert(result)看看result是不是json对象。。。。