[Phpmyadmin-devel] AJAXify phpMyAdmin Interface - GSOC 2011 - Add a new user in db-> privileges

Marc Delisle marc at infomarc.info
Mon May 30 02:36:39 CEST 2011


Le 2011-05-29 12:41, Thilanka Kaushalya a écrit :
> Hi Marc,
> 
> 
>> I don't understand why you are talking about a JSON object. JSON is a
>> text-based notation and in your first screenshot, the text shown is in
>> JSON. It contains a variable "message" with a large chunk of generated
>> HTML. This is fine.
>>
>>
> This is pure text kind of thing. I cannot get the message by calling it
> mydata.message.
> 
> 
>> For an example on how this is handled, look in libraries/sql.js in the
>> section $("#sqlqueryform.ajax") to see what is done with data.message.
>>
>>
> I went through similar scenarios handled in functions.js and sql.js. But in
> all those cases the "data" variable returns an object. So we can call the
> elements such as data.sucess , data.message, data.sql_query out of that
> element. I attached the screenshot of the echo of that object within the
> function.sql $("#create_table_form input[name=do_save_data]").live('click')
> event here as the 1st image [1].
> 
> But the variable mydata in the server_privileges.js is not an object kind of
> thing. So we cannot call the elements such as mydata.sucess ,
> mydata.message, mydata.user_form. When we call them it shows those are
> "undefined". Thats why I cannot handle this situation.
> 
> [1] -
> https://docs.google.com/document/d/1DLcwm4VJv-IrLBiwlRwFPs4oaSuC_bPOsxrJ99xWB8Y/edit?hl=en_US&authkey=CKLN4fUP#
> 
> 
> Regards,
> Thilanka.

Thilanka,
I'm not sure why sometimes the returned data is not considered to be an
object. It might be because, in the case of long strings, we are not
respecting JSON in some manner. In this case, you can use logic similar
to the one in sql.js where we use typeof

if (typeof data.success != 'undefined') {
...
} else {
...
}


P.S. are you using Firebug? it's an invaluable tool to debug these kind
of things.



-- 
Marc Delisle
http://infomarc.info




More information about the Developers mailing list