Ajax using Prototype.js in OFBiz - ajax

I need to make an Ajax call inside OFBiz framework using prototype.js. I am doing that from a .ftl file. I am confused about how to handle the server side - through Java event or Java service? What is the best practice? And also I am having problems making the framework recognize the prototype.js file. There is some issue with the path name in the script tag. It has to be some peculiar naming as per OFBiz framework standards.
I searched Google but I only found links on how to use prototype but none on the combination of prototype + OFBiz. If anybody has done anything in OFBiz like this, please help.

The server process the AJAX request just like any other request. It may contain an event or not, and the response your js function will get is the HTML output ( if the response is a view ). If you want to use JSON, you must create an event with type="jsonservice" ( and you must include the jsonservice handler in your controller file ). This way you can send and receive data structures using AJAX.

Related

Openerp or odoo use ajax to send POST and GET data ? without refreshing

I want to know the technology used in ODOO(Openerp) to send POST and GET data without refreshing the page: because I don't see any AJAX code !!
Odoo is using http POST/GET requests to update the user interface. A combination of javascript making requests on the page and controllers responding. Odoo also uses longpolling to allow the server to provide updates to the client.
Take a look at the web addon
Of particular note would be
addons/web/controllers/main.py
and
addons/web/static/src/js
The js directory mentioned above (i am sorry there is a lot there). Defines how the standard ui widgets work (and much more). Most of the files are reasonably named to give you an indication of what is going on in each file.
You will also want to look at the framework directory within the above noted directory.
There you will find ajax.js which (you guessed it!) is the Odoo ajax module.
NOTE: The above directories are similar in Odoo8 however Odoo9 and Odoo10 have the above structure. Odoo8 does not have an ajax.js (to my knowledge) .

How to recognise an ajax application?

How can I decide if a website is using Ajax technology? What are the characteristics that I should I look in the website to tell it is an ajax application?
Search the javascript for XMLHttpRequest. Beyond that, the working definition of Ajax is rather too broad to look for, say, specific behaviours.
You can just look into the javascript source code and search for .ajax, .post and .get . If you find any of these they use ajax technologies.
You can also look at the network requests a page sends, if the page sends requests after loading the full page without you seeing it refreshing it probably uses ajax.
There's nothing special about websites using AJAX, it just means they make an asynchronous call to the server at some point. You can't know for certain that the website will make such a call unless you run it.

Who create Ajax (Asynchronous JavaScript and XML)?

Honestly, I cannot find out the trust-able source of who create Ajax.
I just know that It become more popular by Google in 2005.
Anyone could guide me please?
Techniques to call server side code from client side script existed before AJAX existed, for example using a Java applet or a hidden frame/iframe to make a request to the server.
The work on the XMLHTTPRequest object that is now used for AJAX calls was begun by Microsoft around 1999. Reference: Wikipedia: XMLHttpRequest

What is the best way for creating asynchronous web application

i'm Trying to implement a web application and it's like a mix of some of twitter , facebook , pinterest features so the app is highly dependent on asynchronous calls to the server , any help with that i just want to know whether to use just ajax or there is some other magic do do better .
you will need ajax to hit server side code. And will be in need soon when you need to call javascript from serveide code ie reverse ajax.
By using DWR framework you can acomplish both of them.
Other wise using jquery's ajax functionality will be a great help.

qtranslate plugin and ajax requests

I'm trying to obtain the correct content for each language (I'm using qtranslate plugin in Wordpress environment) loaded by Ajax calls.
Every time, contents are shown up only in the default language.
I'm thinking about to pass the default-language-qtranslate variable into the ajax calls but I don't know how.
Maybe someone out here has already solved this issue..?
Thanks guys
This will help you to fix the default language request in Mailpress, or any other plugin.
Search in code for link request "ajax.php". Replace "ajax.php" with ajax.php/?lang='.qtrans_getLanguage()

Resources