1.JQuery in $.ajax () method parameter detailed
Http://blog.sina.com.cn/s/blog_4f925fc30100la36.html
2. Server-side Get string Que=request.getparameter ("que");
3. The client requests the full code (highcharts).
<! DOCTYPE html> $(function() { //$ ("Input[type=button]"). Bind ("click", Showchart); //alert (' error! ');$ (' #show-button '). On (' click ',function(e) {Showchart (); }); $(' #clear-button '). On (' click ',function(e) {clearplot (); }); }); varChart; functionClearplot () {//Console.log ("Clear plot data!!!"); varSeries =chart.series; while(Series.length > 0) {series[0].remove (false); } chart.redraw (); }; functionShowchart () {$.ajax ({URL:"Servlet/charts", type:"POST", DataType:"JSON", data: {"Que": $ ("#inputque"). Val ()}, Success:function(data) {varJSON =eval (data); if(JSON! = "" && json! =NULL) {Chart=NewHighcharts.chart ({Chart: {renderto:' Container ', type:' Line '}, Title: {text:' Topic trend Analysis '}, Subtitle: {text:‘‘}, Xaxis: {categories:json.c Ategories}, YAxis: {title: { Text:' percent (%) '}, min:0}, Plotoptions: {line: { DataLabels: {enabled:true}, Enablemousetracking:true}}, tooltip: { Formatter:function() { return' <b> ' + This. Series.Name+ ' </b><br/> ' + This. x + ': ' + This. Y + ' times '; }}, series:json.series}); Chart.settitle (NULL,NULL,true); }}, Error:function() {alert (' error! '); } }); } </script> <div style= "Margin:auto;text-align:center;" > <div style= "padding:10px;" > <input type= "text" name= "que" id= "inputque" > <input type= "button" id= "Show-button" value= "Test highcharts"/> <input type= "button" id= "Clear-button" value= "Clean"/> </div> <div id= "Container"style= "Height:480px;width:980px;background-color: #efefef;" ></div> </div></body>View CodeAjax uses JSON for server-to-client communication