reading input file from server and displaying output on client side

Posted by tazim on Stack Overflow See other posts from Stack Overflow or by tazim
Published on 2010-06-11T09:56:12Z Indexed on 2010/06/11 10:02 UTC
Read the original article Hit count: 201

Filed under:
|
|

Hi,

I have to read a file from server side . Obtained its contents stored it in a list and sent it to template Now, My question is how to access this list so as to display the contents of files line by line . I am using ajax and jquery to obtain the data on client side

def showfiledata(request):      
    f = open("/home/tazim/webexample/test.txt")  
    list = f.readlines()  
    return_dict = {'list':list}  
    json = simplejson.dumps(list)  
    return HttpResponse(json,mimetype="application/json")  

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX