accessing php page by ajax.. - Joomla! Forum - community, help and support


from main page of component call page ajax.php jquery ajax.but @ first problem adding following lines solved -
error_reporting(0); ini_set('display_errors', false);
define('_jexec', 1); defined('_jexec') or die("restricted access");

but problem jpath_base,juri..... classes not working in ajax.php when called ajax!. same behaviour when submit form page.

please experts

in controller:

code: select all

 
 public function ajaxtask()
 {
     $app = &jfactory::getapplication();
     //some actions ....
     //return result
     $app->close();
 }

jquery ajax:

code: select all

  jquery.ajax({
     url: "index.php",   // send request index.php, not ajax.php
     data:
     {
           option: "com_yourcomponent",
           task: "controller.ajaxtask",
           // variblies
     },
     success: function(data)
     {
          // ...
     }
  });





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support