I need to pass the parameters to URL.I have posed the code.
How can I pass the username and password entered in the textbox to URL in my code.thanks for any help..
You should not send password in the URL.
If you want to pass some other details: Update these two lines as below:
data: {data1:$("input#data1").val(),data2:$("input#data2").val()},
url: "http://localhost:53179/hdfcmobile/hdfc.ashx",
Try below code:
You can try your code in this pattern...
var sdate = $('#banners_startdate').val();
var edate = $('#banners_enddate').val();
if(sdate != '' && edate != ''){
$.ajax({
url: 'your url',
data: 'apiname=get_banner_stat_platform_sharing&var=bannerstats&sdate=' + sdate + '&edate=' + edate,
dataType: 'html',
success: function(data){
$('#bannerstats').html(data);
return false;
}
});
}
Where username and password can be fetch by id:
function ajaxcall(username,password)
{
jQuery.ajax({
type: "POST",
url: "Enter Url to pass",
data: {user: username, pass: password},
dataType: "html",
success: function(data) {
//write code what you want to do here
}
});
}
You can fetch the value on page by just $_POST['user'] and $_POST['pass'].
javascript. It'sjavascript.