Processing AJAX request.done data
As part of a case statement "Execute Query" I want to add code to use two radio buttons to select a type of query. One to select "Player" info and the other to select "Future" info. Once a choice is selected a flag will be set to pass on to the function "getQuery(query); "
Problem is all the code beginning with var str="<input... and ending with the function "function doquery(querytype)" is skipped.
Appreciate help to make this work.
(I'm thinking maybe I'll have to have two case statements Execute 1 and Execute2.)
- case 'Execute Query':
var str="<input class='pd' type='radio' name='choice' value='Player Data'>Player Data </input>";
str+="<input class='pd' type='radio' name='choice' value='Future Data'>Future Data </input>";
$("#futurebox").append (str+"<p></p>");
$(".pd").on('change', function() {
var querytype=$("input[name='choice']:checked").val();
doquery(querytype);
});
function doquery(querytype) {
alert('stop');
alert(querytype);
}
var query=$('textarea').val();
var semiColon=/;$/; // reg expression - is semi-colon last char
if(!semiColon.test(query)) { // test for semi-Colon and if none add it
query=query+";";
}
getQuery(query);
break;