need help to send variable from javascript to PHP -
i try send data html process page. want use javascript. javascript is:
$('#search').click(function(){ var param = serialize({ action:"searchmodelqp", jhead:"aadata", month:$("#search_month").val(), year:$("#search_year").val(), export:"excel" }); $('#link2excel' ).replacewith("<div id='link2excel'><a href='shows_merchan.php?" + param + "' target='_blank'>export result excel file</a></div>"); });
and send this:
if(getvar('export')=='excel'){ $expexcel = 'excel'; } else { $expexcel=0; } switch(getvar('action')){ case 'searchmodelqp': modelqp(getvar('jhead'),getvar('month'),getvar('year'),getvar('export')); break; } function modelqp($jsonhead,$month, $year,$export){ $month = mysql_real_escape_string($month); $year = mysql_real_escape_string($year); switch($jsonhead){ case 'aadata': //i put mysql query here break; } if($export==0) { //do } else { //do }
how do make clear?because have no result this(script nothing).
change data below
data:action="searchmodelqp&jhead="aadata"&month=$("#search_month").val()&year=$("#search_year").val()&export="excel"
Comments
Post a Comment