Hi,
I have a function in controller 

def get_data_content():
    message = []
    dateSel = str(request.vars.dateSel).replace("-","")
    tmp_file = "/tmp/data/View" + dateSel
    f = open(tmp_file, 'r')
    for lineContent in reversed(list(f)):
        lineMessage = {}
        lineMessage['data'] = unicode(lineContent, "latin-1")
        message.append(lineMessage)
    return dict(records=message)


I do an ajax call as follows

    $.ajax({
        url: "get_data_content.json",
        type: "POST",
        data: {
            dateSel: dateField
}
    }).done(function( responseMsg ) {
        alert(responseMsg);
    }).fail(function( jqXHR, textStatus, errorMsg ) {
        if(jqXHR.status == 200) {
            alert("Unable to load the data, try again after some time.");
        } else {
            alert("Error : " + jqXHR.status + " " + errorMsg);
        }
    });

This work but not always.
This fails dont know for some reason.
I think and sure that the data is processed and sent to the client, but on 
the client ajax it falls under "*fail"* state, because of that I am not 
able to get the response message. I get an error message which is empty.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to