Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to use Jquery AJAX in Joomla Components?
    text
    copied!<p>i m developing site in Joomla, meanwhile i stuck in a problem,please help me in below problem</p> <p>here is my folder structure for component</p> <pre><code>htdocs/Joomla/administrator/component/com_test/test.php,controller.php models/test.php controllers/test.php views/test/view.html.php view/test/tmpl/default.php </code></pre> <p>now in <code>view.html.php</code> i created a form where i m using <strong>jquery ajax code for usernmae availability check</strong></p> <p>but i m not getting how do i combine all things to get the result that usename is available or not</p> <p>here is my code written on <strong>test/view.html.php</strong></p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(document).ready(function(){ jQuery("#username").change(function () { var usr = jQuery("#username").val(); if (usr.length &gt;= 2) { jQuery("#status").html('&lt;img src="loader.gif" align="absmiddle"&gt;&amp;nbsp;Checking availability...'); jQuery.ajax({ type: "POST", url: "index.php?option=com_test&amp;view=check_user", data: "username=" + usr, success: function (msg) { jQuery("#status").ajaxComplete(function (event, request, settings) { if (msg == 'OK') { jQuery("#username").removeClass('object_error'); // if necessary jQuery("#username").addClass("object_ok"); } else { jQuery("#username").removeClass('object_ok'); // if necessary jQuery("#username").addClass("object_error"); jQuery(this).html(msg); } }); } }); } }); &lt;script&gt; &lt;form action="" method="post" name="addUserForm" id="addUserForm" &gt; &lt;table width="100%" border="0" cellpadding="4" cellspacing="2"&gt; &lt;tr&gt; &lt;th &gt;User Name :&lt;/th&gt; &lt;td &gt;&lt;input type="text" name="username" id="username" size="50"&gt; &lt;span id="status"&gt;&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <hr> <p>i have created below folders structure for above action , please tell me where do i mistake</p> <pre><code>view/check_user/view.html.php views/check_user/tmpl/default.php </code></pre> <p>code in <strong>check_user/view.html.php</strong></p> <pre><code>&lt;?php // no direct access defined('_JEXEC') or die('Restricted access'); jimport( 'joomla.application.component.view'); /** * HTML View class for the advertising component */ class TestViewCheck_user extends JView { /** * Default display function */ function display($tpl = null) { $testController = new TestController(); // Make an object of Main Model class contains Main functions $testModel = $testController-&gt;getModel('test'); $userName = JRequest::getVar('username'); parent::display($tpl); } } ?&gt; </code></pre> <p>but when i run this code...why <code>http://localhost/Joomla/includes/js/joomla.javascript.js</code> file runs infinite times.. and finally give 4 error</p> <p>now what i have to modify/add more??? please just guide me ....</p> <p>refer any useful link which teach to create component step by step ...it will be very helpful for me</p> <p>Thanks a lot </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload