[Phpmyadmin-devel] Need help, about AJAX

Atul Pratap Singh atulpratapsingh05 at gmail.com
Mon May 26 13:09:16 CEST 2014


On 5/26/14, Edward Cheng <c4150221 at gmail.com> wrote:
> 2014-05-26 18:19 GMT+08:00 Atul Pratap Singh <atulpratapsingh05 at gmail.com>:
>
>> On 5/26/14, Edward Cheng <c4150221 at gmail.com> wrote:
>> > 2014-05-26 17:56 GMT+08:00 Atul Pratap Singh <
>> atulpratapsingh05 at gmail.com>:
>> >
>> >> On 5/26/14, Edward Cheng <c4150221 at gmail.com> wrote:
>> >> > 2014-05-26 17:22 GMT+08:00 Michal Čihař <michal at cihar.com>:
>> >> >
>> >> >> Hi
>> >> >>
>> >> >> Dne Mon, 26 May 2014 16:59:54 +0800
>> >> >> Edward Cheng <c4150221 at gmail.com> napsal(a):
>> >> >>
>> >> >> > Hi, I'm writing console.js AJAX part.
>> >> >> > But I see two global AJAX handlers, if I want to
>> >> >> > use them, is that means I can't handle the response
>> >> >> > event?
>> >> >> > How can I write own response callback while using
>> >> >> > global handlers?
>> >> >>
>> >> >> Maybe following wiki pages will help you:
>> >> >>
>> >> >>
>> >>
>> https://wiki.phpmyadmin.net/pma/Generating_pages_and_ajax_responses_in_pma4
>> >> >> https://wiki.phpmyadmin.net/pma/Page_loader
>> >> >
>> >> > ​That not help me, I want to handle response data,
>> >> > get information and put them to console log...
>> >> >
>> >> From https://wiki.phpmyadmin.net/pma/Page_loader I get:- "In order for
>> >> the generic page loader not to handle such cases, it is necessary to
>> >> add an "ajax" class to the link or form"
>> >>
>> >> So you can of course write your custom handler and handle response
>> >> your own way. You just need to add class "ajax" to your element for it
>> >> to work.
>> >>
>> > ​I need global handlers handle my requests(show query result just like
>> > click a link), also need my handlers handle response data(update
>> > console
>> > messages).
>> >
>> So you mean that you want global handlers to send requests for you and
>> you want to handle response yourself? Well then why not write custom
>> handlers?
>>
>> Or if you mean something else please explain more.
>>
> ​Yeah, ​I made a console, you can type queries, execute queries, and
> check logs on it.
> When you type a query, press ctrl+enter you'll see the result comes out
> replace your currect page, AJAX.requestHandler will take this job,

For executing and fetching query results, please also take a look at
existing system in sql.js where custom handler is written for
#sqlqueryform.ajax. So I think you could just pass the query to this
existing system and page replacing will happen.

About pushing subsequent sql result pages to AJAX.cache, I think it is
not required and is not done right now. We currently push to
AJAX.cache when user switches between different tabs etc. and not for
subsequent sql result pages.

> but console only shows query string, I need handle response data, so I can put results
> on console logs, and errors and other messages.
> Thanks :)
>
So console div would be out of page_content and will not be
removed/replaced as queries get executed from the console. For this
also, I think you can write a custom handler.


-- 
Atul Pratap Singh
http://blog.atulsisodia.in/




More information about the Developers mailing list