I'm not quite sure what is going on here, as I've never used callbacks with
async set to false. It should work if you use this:
var result = $.ajax({
url:"http://localhost:8081/mHealth/MapData",
type:"get",
dataType:"text",
async:false,
error: function(result){
alert("There is no data to populate the map.");
}
}).responseText;
Alternatively, you could make it asynchronous and put the rest of your code
into the success callback and see if that works.
If you direct the ajax query to a non-existent URL, does the error code run?
On Monday, November 26, 2012 10:52:12 AM UTC-5, Michael Ofori-Appiah wrote:
>
> I ma trying to get data using jqery.ajax from a servlet but it is not
> returning data. However, when I run the servlet url in the browser, it
> displays the data.
> The code is as shown below: Both the success and error does not return
> anything. Can anybody please assist.
>
> function drawChart() {
> var result=null;
> $.ajax({
> url:"http://localhost:8081/mHealth/MapData",
> type:"get",
> dataType:"text",
> async:false,
> success:function(data){
> result= data;
> },
> error: function(result){
> alert("There is no data to populate the map.");
> }
> });
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/9ET7pqrBefUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.