Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you can also use this method I checked it on keyup you can use it via onblur option.</p> <pre><code> &lt;input type="text" value="" id="jform_domain_name" name="jform[domain_name]" onkeyup="checkAvailability();"/&gt; &lt;div id="errormsg" class="no-display"&gt;Sorry, this name is not available!&lt;/div&gt; &lt;div id="successmsg" class="no-display"&gt;Congratulations, this domain is available!&lt;/div&gt; &lt;script&gt; function checkAvailability(){ jQuery('#ajaxloader').html('&lt;img src="images/ajax-loader.gif" /&gt;'); var string = jQuery('#jform_domain_name').val(); if(string == ''){ jQuery('#ajaxloader').html(''); return false; } jQuery.ajax({ type : "POST" ,url : "YOUR_ACTION_URL" ,data :"string="+jQuery('#jform_domain_name').val() ,success : function(data){ if(data==0){ var errormsg = jQuery("#errormsg").html(); jQuery("#ajaxloader").show(); jQuery('#ajaxloader').html(errormsg); }else{ var successmsg = jQuery("#successmsg").html(); jQuery("#ajaxloader").show(); jQuery('#ajaxloader').html(successmsg); } } ,complete : function(){ if( jQuery('#jform_domain_name').val() == "" ) { jQuery("#ajaxloader").hide(); } } ,beforeSend: function(html){ jQuery("#ajaxloader").show(); jQuery('#ajaxloader').html('&lt;img style="padding-top:6px;" src="images/ajax-loader.gif" /&gt;'); return; } }); } &lt;/script&gt; </code></pre> <p>for reference I am providing my controller action and the model which I have used</p> <pre><code>//sample controller action function checkdomain(){ $requestData = JRequest::get(); $return = $model-&gt;checkAvailabiLity($requestData['string']); if($return === false){ echo 0; }else{ echo 1; } die; } //sample model on which I created Query logic. public function checkAvailabiLity($data){ $select = "SELECT id FROM #__jshopping_vendors WHERE domain_name = '".strtolower($data)."' AND user_id != ".$user-&gt;id.""; $db-&gt;setQuery($select); $type = $db-&gt;loadObject(); if(isset($type-&gt;id) &amp;&amp; $type-&gt;id &gt;0){ return false; }else{ return true; } } </code></pre> <p>hope this helps....</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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