AJAX plus attr()
AJAX plus attr()
I want to go to a page with ajax in the background and return a value of a field. I keeps on returning nothing.
this is what I have so far.
-
$.get("file.php", function(data){
var response = $(data).find('[name*=user]').attr("value");
alert(response);
});
update:
-
$.ajax({
type: "POST",
url: "file.php",
async: false,
beforeSend: function(msg){
var i = $(msg).find('[name*=user]').attr('value');
console.log(i);
},
success: function(msg){
alert("sucess");
}
});
How would i do it?