Gulboy, Can you find out what URL results from the string '@Url.Content( "/OptionPortfolio/googleScatterChart/")' ? Is that string translated by ASP (or something else) so that $.ajax() is given a proper URL?
Can you look in your browser to see what code is generated by the server? Is there a JavaScript error that would provide a clue about what is happening? On Mon, Aug 25, 2014 at 3:27 PM, <[email protected]> wrote: > Hi, > > Hi have the following partial view that works properly when called from > the command line such as: > > > http://localhost:59739/OptionPortfolio/googleScatterChart/?ivyID=122392&ticker=GLD&ivyID2=126928&ticker2=GDX&dtStart=3%2F15%2F2014+12%3A00%3A00+AM&dtEnd=8%2F22%2F2014+12%3A00%3A00+AM > > > Partial view: > > <script type="text/javascript"> > > google.load("visualization", "1", { packages: ["corechart"] }); > > google.setOnLoadCallback(drawChart); > > function drawChart() { > > var mod = @Html.Raw(Json.Encode(Model)); > > var titre= @Html.Raw(Json.Encode(Model.title)); > > var titre_x= @Html.Raw(Json.Encode(Model.title_x)); > > var titre_y= @Html.Raw(Json.Encode(Model.title_y)); > > var min_x= @Html.Raw(Json.Encode(Model.min_x)); > > var max_x= @Html.Raw(Json.Encode(Model.max_x)); > > var min_y= @Html.Raw(Json.Encode(Model.min_y)); > > var max_y= @Html.Raw(Json.Encode(Model.max_y)); > > var jsonData = $.ajax({ > > url: '/OptionPortfolio/googleChartData', > > data: mod, > > dataType: "json", > > async: false > > }).responseText; > > // Create our data table out of JSON data loaded from server. > > var datatbl = new google.visualization.DataTable(jsonData); > > var options = { > > title: titre, > > hAxis: { title: titre_x, minValue: min_x, maxValue: max_x }, > > vAxis: { title: titre_y, minValue: min_y, maxValue: max_y }, > > legend: '', > > }; > > var chart = new > google.visualization.ScatterChart(document.getElementById('chart_div')); > > chart.draw(datatbl, options); > > } > > </script> > > <div id="chart_div" style="width: 900px; height: 500px;"></div> > > > > however, the whole page goes blank when called from the main page: > > $.ajax({ > > > url: '@Url.Content("/OptionPortfolio/googleScatterChart/")', > > data: kk, > > success: function (result) { > > $('#googlechart_div').html(result); > > }, > > error: > > > function (result) { > > alert(result); > > } > > }); > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Google Chart API" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-chart-api. > For more options, visit https://groups.google.com/d/optout. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> - 978-394-1058 [email protected] <[email protected]> 5CC, Cambridge MA [email protected] <[email protected]> 9 Juniper Ridge Road, Acton MA -- You received this message because you are subscribed to the Google Groups "Google Chart API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-chart-api. For more options, visit https://groups.google.com/d/optout.
