close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

AJAX functionality...

Thread began 1/18/2013 2:04 pm by alnico431299 | Last modified 1/18/2013 2:04 pm by alnico431299 | 669 views | 0 replies

alnico431299

AJAX functionality...

When I bought the suite a few months ago, support reassured me that AJAX requests could be handled. I have determined that this is not the case unfortunately. However, I was determined to find a solution.

I have been testing a simple solution for a few months that works beautifully; and it does not in any way impact current functions.

The problem:
Jquery/javascript sends an Xhr (AJAX) request to ’webassist authenticate user’ script, the script will exit when either ‘success’ or ‘failure’ parameters are set and redirect using: header("Location:…”) (a new url).

A solution:
By using a convention for the ‘success’ or ‘failure’ parameters…I can say ‘if parameter begins with ‘ajax_’ then treat it as an AJAX request, and simply echo the parameter'. The client side script would then get the request response and handle it appropriately. Example parameters: ajax_authenticationSuccess and ajax_authenticationFail.

If parameter does not begin with ‘ajax_’ then redirect as usual.

In helper_php.php it is easy to wrap the redirect with an if/else statement like this:

if (preg_match('/^ajax_/i', $WA_Auth_Parameter["successRedirect"])) {
echo $WA_Auth_Parameter["successRedirect"];
} else {
header("Location: ".$WA_Auth_Parameter["successRedirect"]); //webassist original line
}
exit();

To add this to the widgets, (instead of using ‘ajax_’), you could simply add a checkbox labeled ‘AJAX’ for each input/redirect field (a checkbox for each is good as I have sometimes mixed AJAX and Header redirects in a single script).

This would be nice to have baked into every widgets that does redirects.
And the best thing is that it would not have any impact on legacy code, etc.

Brent

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...