jQuery return link
jQuery return link
I have following GetLink function to return a url to button click which browser go to the link return.
I wanted to add jQuery to validate and prompt user to choose to continue or not.
Once I added jQuery then it does not go to link, it seems that GetLink function does not return right link to jQuery.
The confirm message shows when it validates the result.
I think I am missing something here to get link from javascript to jQuery.
Your help and information is great appreciated,
Regards,
iccsi
function GetLink()
{
var url = 'MySite.cfm?MyValue=' + jQuery("#MyText").val();
return url;
}
<td> <cfinput type="button" name="Submit" class="Submit" id="Submit1" value="Get Report" onclick="javascript:window.location.href=GetLink()"></td>
jQuery("#Submit1").click(function(event) {
jQuery.ajax({
url: 'MyServer.cfc?method=MyMethod&MyValue=' + jQuery("#MyText").val(),
type: 'GET',
dataType: 'json',
success: function(data)
{
if (data > 0 )
{
var retVal = confirm("do you want to Continue ?");
if( retVal == true ){
GetLink();
return true;
}
else
{
return false;
}
}
else
{
GetLink();
}
}
})
});