Hello

I menage to call my function that is in my default.py controler  from my 
view but I cannot  retrieve data that this function is suppose to retrieve

function is called on button click to load some text from database into ACE 
editor 

this is some of my code in controler.py 

def load_last():
    PgSQL = db_conn()
    cur = PgSQL.cursor()
    sql_read = "SELECT file_text FROM datoteke WHERE id = (SELECT max(id) 
FROM datoteke)"
    cur.execute(sql_read)
    ver = cur.fetchone()[0]
    print ver
    
    return dict(data = ver)

in my editor.html view my java script code that should get data from def 
load_last functions is

function load_last() {
   var editor = ace.edit("editor");
   editor.setValue("");
   $.ajax({
   url: "{{=URL('default', 'load_last')}}",
   data: {}, //*WHAT DO I WRITE HERE*
   success: function(){
   console.log("neki je ratal");
   },
   dataType: 'html'
 });
}


I am really stuck here

In addidtion another question. What would you recommend,  a user writes 
some text in my ace editor that is saved in a database. Text is varified 
for errors with engine on server and if there is an error user has to be 
prompted to correct them, only after that he can save data. What would be 
the best way to do that. 

Also user can read file from database to update an existing file. any 
recomendations

please help
thank you

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to