The problem is that when you initialize ks
, the value
hasn't been set.
You need to fetch the value when user submits the form. So you need to initialize the ks
inside the callback function
(function($){
$(document).ready(function(){
$('#data').submit(function(e){
//Here it will fetch the value of #keywords
var ks = $('#keywords').val().split("\n");
...
});
});
})(jQuery);