Hi I have html form
<form name="myForm" action="login.php" method="post" >
<input type="text" name="login" id="loginName" class="input" placeholder="Enter the User name here">
<input type="password" name="password" id="password" class="input" placeholder="Enter the Password here">
<input type="hidden" name="XML" id="hiddenField"/ >
<input type="button" id="login1" class="btn" value="Login"/>
</form>
I am sending it to a php in the form of a xml string
$("#login1").click(function(e) {
alert("hello");
e.preventDefault();
XML += "<user_name>" + $("#loginName").val();
XML += "</user_name><password>" + $("#password").val();
XML +="</password>";
alert("test");
alert(XML);
$("#hiddenField").val(XML);
$("form[name='myForm']").submit();
});
now how do i fetch xml resonse from the same php...
i included $.ajax function inside the onclick function but it dint fetch any record...
$("#login1").click(function(e) {
alert("hello");
e.preventDefault();
XML += "<user_name>" + $("#loginName").val();
XML += "</user_name><password>" + $("#password").val();
XML +="</password>";
alert("test");
alert(XML);
$("#hiddenField").val(XML);
$("form[name='myForm']").submit();
$.ajax({
url: "login.php",
type: "POST",
dataType:"xml",
async: false,
data: "xml",
success: function(msg)
{
alert("test ajax");
$xml = $( msg ),
alert($xml.text());
$xml.find('response').each(function(){
alert("response login");
$status_message = $xml.find( "status_message" );
alert("status_message:"+ $status_message.text());
});
}
});
});
looking forward for a reply...