javascript - Ajax request, null data, path to the server rails -
i have client request ajax, final url /promotion?mtd
, log tell me parameter mtd = null. should promo = mtd, need data passing in url.
ajax:
var promo = document.getelementbyid('data-select').value; $.ajax({ type: 'get', url: '/promotion', data: promo, datatype: 'json', success: function(data){ alert(data); } });
log/development.log:
started "/promotion?mtd" 127.0.0.1 @ 2015-04-14 16:32:34 -0430 processing promoscontroller#get_percent json parameters: {"mtd"=>nil}
var promo = document.getelementbyid('data-select').value; $.ajax({ type: 'get', url: '/promotion', data: {"promo" : promo}, datatype: 'json', success: function(data){ alert(data); } });
Comments
Post a Comment