Edward,

On Fri, May 30, 2014 at 2:02 PM, Edward Cheng <c4150221@gmail.com> wrote:
I'm writting AJAX part now.
Have a look at this commit:
See my comment on it: 
  For get response data I add a param, run between requestHandler and responseHandler.

As I understand, this mid-handler is your responsehandler that subsequently makes a call to the generic responsehandler of ajax.js. So it is not a real custom handler (that requests + handles response independent of the generic one)

Also, as I understand from your code, the proposed console would store a log of run queries and on running a query from console, the results will be displayed in the same way as happens when running a query from SQL tab. Right ?

As per this understanding, you need a real custom handler because executing SQL and handling its response in PMA involves many custom checks and calls not only at response stage but also at request stage. For ex:-
- checkSqlQuery()
- bookmark handling
- reloading navigation for certain queries
- refreshing main panel for certain queries
- triggering grid edit for results
etc. see in sql.js near  $("#sqlqueryform.ajax").live('submit', function (event) {

Or did you plan to duplicate above checks and calls into your midhandler?

Also, I don't understand why you need to call the generic response-handler of ajax.js? Remember that we don't need to populate AJAX.cache either.


Now middle handler runs well, but I can't send
message ID to PMA_console._responseMidHandler, my
questions are:
1. Is the middle handler OK? Or is there another way to
custom my AJAX request(I need pages jump use global
AJAX handlers)

Yes, you need to totally skip the generc/global AJAX handlers, for that you add a "class=ajax" to your form and write a custom handler.


-- 
Regards

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