Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » How do I…?
  3. » Txp Ajax

#1 2012-09-05 05:58:34

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Txp Ajax

HI.

After download TXP 4.5 I don’t found any information about txpAsyncForm and txpAsyncHref.
How can i use it?
There is some wiki or example?

Thanks

Offline

#2 2012-09-05 12:34:32

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Txp Ajax

Start here.

Offline

#3 2012-09-05 14:57:49

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: Txp Ajax

wet wrote:

Start here.

Thanks for sample.

Minor fix, change line 120 to

__CLASS__

and line 130 to

$in = escape_js(ps('my_name'));

aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#4 2012-09-05 15:24:28

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Txp Ajax

Good catch. Fixed.

Offline

#5 2012-09-06 07:50:52

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: Txp Ajax

Are there any ideas about textpattern and frontside-ajax?

Or just take a jquery + callback('pretext') ?


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#6 2012-09-06 19:44:03

etc
Developer
Registered: 2010-11-11
Posts: 5,057
Website GitHub

Re: Txp Ajax

Most js frameworks (jQuery and such) send HTTP_X_REQUESTED_WITH header, so you could filter ajax calls this way:

<txp:etc_query globals="_SERVER" data="{?HTTP_X_REQUESTED_WITH}">
  ajax stuff
<txp:else />
  non-ajax
</txp:etc_query>

Offline

#7 2012-09-07 06:32:38

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: Txp Ajax

Thanks Robert!

Offline

#8 2012-10-17 16:44:22

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: Txp Ajax

Robert in your example plugin you use a new tab under extension.

If I try using a plugin_ui as register_callback(array(__CLASS__, 'dispatch'),'image_ui','extend_controls'); with your original plugin’s function it show the correct form, but when i click on Hello, it return all html page with all images!!

Why it not work?

Offline

#9 2012-10-18 07:50:16

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Txp Ajax

Marco, the image tab does not use an AJAX form.

If you want to extend the image form, your duties include adding a form which sends its request via AJAX (which you did), plus adding some code which replies with a suitable response (which you apparently did not).

If you try to extend an existing form like the image tab which doesn’t use AJAX itself you have to suppress the core’ s own responses. Otherwise the server will continue to output plain HTML. There’s nothing which tells it otherwise.

Offline

#10 2013-10-01 08:23:50

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: Txp Ajax

I reopen this 3D.

I’m doing some experiments with ajax call… and thanks to Robert example I understand how the 2 funcs works.

What i don’t know is how can I create inside a ajax Form two ajax call. Ok, i can use a txpAsyncHref() but whit this function I can’t manipulate the dom of the page.
For doing this thing i need a txpAsyncForm so I can put some js code by send_script_response() but I can’t nested two forms.

There is another way?

Offline

  1. Index
  2. » How do I…?
  3. » Txp Ajax

Board footer

Powered by FluxBB