I have this code right here and I want to change as I commented out on my code.
What function is the right one to use in this scenario?
<span id="value" style="margin: 3px;">
<?php
if(get_forum_likes($id_forum, $pdo) < 0){
echo '<span style="color:#fb3f6c;">'.number(get_forum_likes($id_forum, $pdo))."</span>";
} elseif(get_forum_likes($id_forum, $pdo) > 0){
echo '<span style="color:#25804a;">'.number(get_forum_likes($id_forum, $pdo))."</span>";
} else {
echo number(get_forum_likes($id_forum, $pdo));
}
?>
</span>
<i id="<?php echo $id_forum; ?>" class="vote_up fas fa-angle-up"></i>
<script>
$(document).ready(function(){
$("i.vote_up").click(function(){
var value_no = document.getElementById("value");
var forum_id = $(this).attr('id');
$.post("game/forum/vote_post.php",
{
forum_id: forum_id,
type: 0
},
function(res, status){
// Update 'value' and add 1 to 'value_no' without page refresh
}
);
});
});
</script>
Here is a vanilla solution.
...
function(res, status) {
let spanNode = value_no.childNodes[0];
let newValue = parseInt(spanNode.innerHTML) + 1; // Make sure the text inside span is integer
spanNode.innerHTML = "New value: " + newValue;
}
try with $("#value").html() or $("#value").text()
<span id="value" style="margin: 3px;">
<?php
if(get_forum_likes($id_forum, $pdo) < 0){
echo '<span style="color:#fb3f6c;">'.number(get_forum_likes($id_forum, $pdo))."</span>";
} elseif(get_forum_likes($id_forum, $pdo) > 0){
echo '<span style="color:#25804a;">'.number(get_forum_likes($id_forum, $pdo))."</span>";
} else {
echo number(get_forum_likes($id_forum, $pdo));
}
?>
</span>
<i id="<?php echo $id_forum; ?>" class="vote_up fas fa-angle-up"></i>
<script>
$(document).ready(function(){
$("i.vote_up").click(function(){
var value_no = document.getElementById("value");
var forum_id = $(this).attr('id');
$.post("game/forum/vote_post.php",
{
forum_id: forum_id,
type: 0
},
function(res, status){
$("#value").html();
value_no++
}
);
});
});
</script>
Related
How to call ajax call in tpl template opencart version 2.3
I have api controller with data and that data I need to post in template(tpl) file. Template file is tpl extension , I need open script tag but I don't know how do it in tpl file and how to target endpoint with function? I provide my code. In controller I have api folder and file reifenmontage and function get_marka_data()...How I target this data in tpl file? I know tpl is only for show data but I must do on this way :/
public function get_marka_data() {
$query = $this->db->query("
SELECT mo.marka
FROM " . DB_PREFIX . "model mo
GROUP BY mo.marka
")->rows;
$data = array_map(function($row){
return array('value'=>$row['marka'],'label'=>$row['marka']);
}, $query);
if (isset($this->request->server['HTTP_ORIGIN'])) {
$this->response->addHeader('Access-Control-Allow-Origin: ' . $this->request->server['HTTP_ORIGIN']);
$this->response->addHeader('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
$this->response->addHeader('Access-Control-Max-Age: 1000');
$this->response->addHeader('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($data));
var_dump($data);
}
<script type="text/javascript"><!--
$('#button-getdata').on('click', function() {
$.ajax({
url: 'index.php?route=extension/module/reifenmontage/get_marka_data',
type: 'post',
data: $('#reifenmontage-input select, #reifenmontage-input input'),
dataType: 'json',
beforeSend: function() {
$('#reifenmontage-input').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
},
success: function(json) {
$('.success, .warning, .attention, information, .error').remove();
if (json['success']) {
html = "<!-- Retrieved data -->\n";
for (i in json['success']) {
var element = json['success'][i];
console.log(element);
html += "\t<tr><td>" + element['label'] + "</td><td align=\"right\">" + element['value'] + "</td></tr>\n";
}
$('#reifenmontage-output').html(html);
}
}
});
});
//--></script>
<?php if($heading_title) { ?>
<h2><?php echo $heading_title; ?></h2>
<?php } ?>
<h2><?php echo $description_title; ?></h2>
<?php echo $description; ?>
<div id="reifenmontage-input" class="reifenmontage-input">
<form id="reifenmontage-input" method="post" enctype="multipart/form-data" class="form-horizontal">
<fieldset>
<div class="form-group">
<label class="control-label" for="datum"><?php echo $entry_begin_period; ?></label>
<div class="input-group date">
<input type="text" name="datum" value="<?php echo $current_day . '-' . $current_month . '-' . $current_year; ?>" data-date-format="DD-MM-YYYY" id="datum" class="form-control" />
<span class="input-group-btn">
<button class="btn btn-default" type="button"><i class="fa fa-calendar"></i></button>
</span></div>
</div>
<div class="form-group">
<label class="control-label" for="entry-cyclus"><?php echo $entry_cyclus; ?></label>
<select name="cyclus" id="entry-cyclus" class="form-control">
<option value=""><?php echo $text_select; ?></option>
<?php
for ($i=20;$i<43;$i++) {
if ($i == 28) {
?>
<option value="<?php echo $i; ?>" selected="selected"><?php echo $i; ?></option>
<?php
} else {
?>
<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
<?php
}
}
?>
</select>
</div>
<div class="buttons">
<div class="pull-right">
<input type="button" value="<?php echo $button_create; ?>" id="button-getdata" class="btn btn-default" />
</div>
</div>
</fieldset>
</form>
</div>
<div id="reifenmontage-output"></div>
And for de php-function, change te last part into:
$json = array();
if ($data) {
$json['succes'] = $data;
} else {
$json['error'] = 'Sorry, no data !';
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
Example for form, output id and script to retrieve data from controller in extension/module
In controller/api/reifenmontage.php:
<?php
class ControllerApiReifenmontage extends Controller {
private $error = array();
public function get_marka_data() {
$json = array();
if (isset($this->request->post['marka'])) {
$marka_data_query = $this->db->query("SELECT mo.model FROM " . DB_PREFIX . "model mo WHERE mo.marka='" . $this->request->post['marka'] . "'");
$marka_data = $marka_data_query->rows;
$json['succes'] = $marka_data;
} else {
$json['error'] = 'Sorry, no data !';
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
}
Form with script:
<div id="reifenmontage-input" class="reifenmontage-input">
<form id="reifenmontage-input" method="post" enctype="multipart/form-data" class="form-horizontal">
<fieldset>
<div class="form-group required">
<label class="col-sm-4 control-label" for="input-marka">Marka</label>
<div class="input-group col-sm-8">
<select name="marka" id="input-marka" class="form-control">
<option value="0">Select ...</option>
<option value="AJP">AJP</option>
<option value="APOLO">APOLO</option>
<option value="APRILIA">APRILIA</option>
<!-- All stored marka's -->
</select>
</div>
</div>
</fieldset>
<div class="buttons">
<div class="pull-right">
<button type="button" class="btn btn-primary" id="button-getdata" data-loading-text="Loading ...">Get Data</button>
</div>
</div>
</form>
</div>
<div class="col-xs-12 col-sm-3" style="margin-right:30px;">
<div class="row">
<select class="form-control" id="result">
</select>
</div>
</div>
<script type="text/javascript"><!--
$('#button-getdata').on('click', function() {
$.ajax({
url: 'index.php?route=api/reifenmontage/get_marka_data',
type: 'post',
data: $('#reifenmontage-input select'),
dataType: 'json',
beforeSend: function() {
$('.success, .warning, .attention, information, .error').remove();
$('#result').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" />Please wait ...</div>');
},
success: function(json) {
if (json['error']) {
$('#result').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" />' + json['error'] + '</div>');
}
if (json['success']) {
for (i in json['success']) {
var element = json['success'][i];
//console.log(element);
html = "\t<option value=\""+ element['model'] + "\">" + element['model'] + "</option>\n";
$('#result').append(html);
}
}
}
});
});
//--></script>
New controller/api/reifenmontage.php
<?php
class ControllerApiReifenmontage extends Controller {
private $error = array();
public function get_markas() {
$json = array();
$markas_query = $this->db->query("SELECT marka FROM " . DB_PREFIX . "model GROUP BY marka");
$markas_data = $markas_query->rows;
if ($markas_data) {
$json['success'] = $markas_data;
} else {
$json['error'] = 'Sorry, no data !';
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
public function get_marka_data() {
$json = array();
if (isset($this->request->post['marka'])) {
$marka_data_query = $this->db->query("SELECT mo.model FROM " . DB_PREFIX . "model mo WHERE mo.marka='" . $this->request->post['marka'] . "'");
$marka_data = $marka_data_query->rows;
$json['success'] = $marka_data;
} else {
$json['error'] = 'Sorry, no data !';
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
}
And new script on template / form:
<script type="text/javascript"><!--
function getMarkaData() {
$.ajax({
url: 'index.php?route=api/reifenmontage/get_marka_data',
type: 'post',
data: $('#reifenmontage-input select'),
dataType: 'json',
beforeSend: function() {
$('.success, .warning, .attention, information, .error').remove();
},
success: function(json) {
if (json['error']) {
$('#result').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" />' + json['error'] + '</div>');
}
if (json['success']) {
$('#result2').html('');
for (i in json['success']) {
var element = json['success'][i];
//console.log(element);
html = "\t<option value=\""+ element['model'] + "\">" + element['model'] + "</option>\n";
$('#result2').append(html);
}
}
}
});
}
function getMarkas() {
$.ajax({
url: 'index.php?route=api/reifenmontage/get_markas',
dataType: 'json',
type: 'post',
beforeSend: function() {
$('.success, .warning, .attention, information, .error').remove();
},
success: function(json) {
if (json['success']) {
for (i in json['success']) {
var element = json['success'][i];
html = "\t<option value=\""+ element['marka'] + "\">" + element['marka'] + "</option>\n";
$('#result').append(html);
}
getMarkaData();
}
}
});
}
//--></script>
<script type="text/javascript">
let selectItem = document.getElementById('pneu');
let additionalRow = document.getElementById('additionalRow');
function checkSelected() {
if (selectItem.selectedIndex == "1") {
additionalRow.style.display = 'none';
} else {
additionalRow.style.display = 'flex';
getMarkas();
}
}
$('#result').on('change', function() {
getMarkaData();
});
if ($('#pneu').val() != '1') {
getMarkas();
}
</script>
Next to a input I want to display two div's with plus and minus signs, so that when clicking on one of the divs, the value insdie the input increase or decrease.
It almost works perfect, but the best way to save the input. Is by changing the input and than load the /save url. The input works perfect with this code, that on changing the /save url loads and the value is saved.
I want the same for the div's, that when clicking on the div the value inside the input changes and the value is saved by the /save URL.
How do I need to change my code for this?
CODE HTML:
<div class="quote-item product-quote-qty">
<div id="qdiv_<?php echo $item->getId() ?>" nowrap="nowrap" class="qty-div input-box">
<div class="reduced items item-<?php echo $item->getQty()*1; ?>" onclick="var result_<?php echo $item->getId() ?> = document.getElementById('qty_<?php echo $item->getId() ?>'); var qty_<?php echo $item->getId() ?> = result_<?php echo $item->getId() ?>.value; if( !isNaN( qty_<?php echo $item->getId() ?> ) && qty_<?php echo $item->getId() ?> > 1 ) result_<?php echo $item->getId() ?>.value--;saveForm();return false;">-</div>
<input type="text" name="quote_request[<?php echo $item->getId() ?>][qty][]" id="qty_<?php echo $item->getId() ?>" value="<?php echo $item->getQty()*1; ?>" size="4" title="<?php echo $this->__('Qty') ?>" onchange="location.href='save'" class="required-entry validate-zero-or-greater input-text" maxlength="12" />
<div class="increase items" onclick="var result_<?php echo $item->getId() ?> = document.getElementById('qty_<?php echo $item->getId() ?>'); var qty_<?php echo $item->getId() ?> = result_<?php echo $item->getId() ?>.value; if( !isNaN( qty_<?php echo $item->getId() ?> )) result_<?php echo $item->getId() ?>.value++;saveForm();return false;">+</div>
</div>
</div>
CODE JS:
function saveForm() {
var form = $('quotelist').clone(true);
//update textarea
var i = 0;
$('quotelist').select('textarea').each(function (el) {
form.select('textarea')[i].value = $(el).value;
i++;
});
var action = $('quotelist').action;
action = action.replace("quoteRequest", "save");
form.action = action;
form.request({
onComplete: function(){ Miniquote.reloadContent(); }
});
}
function addQtyFieldSaver(){
$$('#shopping-cart-table input[type=text]').each(function (el) {
return $(el).observe('blur', function(e){
saveForm();
});
});
}
EDIT:
function addQtyFieldSaver(){
$$('#shopping-cart-table input[type=text]').each(function (el) {
return $(el).observe('blur', function(e){
saveForm();
});
});
$('.reduced').click(function () {
var el = $(this).parent().find('input:text');
var newval = (parseInt($(el).val(),10) - 1 > 0)?$(el).val() - 1:0;
el.val(newval);
saveForm();
});
$('.increase').click(function () {
var el = $(this).parent().find('input:text');
var newval = parseInt($(el).val(),10)+1;
el.val(newval);
saveForm();
});
}
Get rid of your PHP code in your plus and minus divs like this
<div class="reduced items">-</div>
<div class="increase items" >+</div>
And add this to your addQtyFieldSaver function
$('.reduced').click(function () {
var el = $(this).parent().find('input:text');
var newval = (parseInt($(el).val(),10) - 1 > 0)?$(el).val() - 1:0;
el.val(newval);
saveForm();
});
$('.increase').click(function () {
var el = $(this).parent().find('input:text');
var newval = parseInt($(el).val(),10)+1;
el.val(newval);
saveForm();
});
With this solution, the click event on the +/- divs accesses the input text field using its parent container in order to get the quantity of the input value and change it. Then calls the function saveForm() to save the new data.
EDIT: Full Example
function saveForm() {
alert('saveform is called');
}
function addQtyFieldSaver(){
$('#shopping-cart-table input[type=text]').each(function (el) {
return $(el).bind('blur', function(e){
saveForm();
});
});
}
$(document).ready(function(){
addQtyFieldSaver();
$('.reduced').click(function () {
var el = $(this).parent().find('input:text');
var newval = (parseInt($(el).val(),10) - 1 > 0)?$(el).val() - 1:0;
el.val(newval);
saveForm();
});
$('.increase').click(function () {
var el = $(this).parent().find('input:text');
var newval = parseInt($(el).val(),10)+1;
el.val(newval);
saveForm();
});
})
<html>
<head>
<title>Ejemplo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript">
</script>
</head>
<body>
<div id="shopping-cart-table">
<div class="quote-item product-quote-qty">
<div id="qdiv_1" nowrap="nowrap" class="qty-div input-box">
<div class="reduced items">-</div>
<input type="text" name="quote_request[1][qty][]" id="qty_1" value="1" size="4" title="1" onchange="location.href='save'" class="required-entry validate-zero-or-greater input-text" maxlength="12" />
<div class="increase items" >+</div>
</div>
</div>
</div>
</body>
</html>
I have the below js code that is working in chrome and IE but not safari and firefox. In both cases, the beforeSend: function works, but the success function does not work. Is this a problem with the CSS or am I missing something in the javascript?
---JS----
$("#updateBidButton").click(function () {
var bid_amount = document.getElementById("auction_bid_input").value;
var item_id = "<?php echo $this->item['id']?>";
var current_bid = "<?php echo $this->item['current_bid']?>";
var url_view = "<?php echo $this->item['url_view']?>";
$.ajax({
type: 'post',
url: "?module=items&controller=index&action=submitBid",
dataType: "text",
data: 'bid_amount=' + bid_amount + '&item_id=' + item_id + '¤t_bid=' + current_bid + '&url_view=' + url_view,
beforeSend: function () {
$('.auction_box').animate({
'backgroundColor': '#ffdead'
}, 400);
},
success: function (result) {
if (result == 'ok') {
$.get(window.location.href, function (data) {
$('.auction_box').animate({
'backgroundColor': '#A3D1A3'
}, 400);
});
} else {
alert(result);
$('.auction_box').animate({
'backgroundColor': '#FFBFBF'
}, 400);
}
}
});
});
Here is the html:
<form action="" method="post">
<div id="<?php echo $this->item['id']; ?>">
<div class="auction_bid_box">
<label for="auction_bid_input">
<!-- Starting bid EXISTS -->
<?php if ($this->item['bid_count'] >= '1') { ?>
You have until <?php echo $this->data['item']['auction_start']; ?> to update the current bid.
<!-- Starting bid is MISSING-->
<?php } else { ?>
You have until <?php echo $this->data['item']['auction_start']; ?> to enter a starting bid.
<?php } ?>
</label>
<span class="auction_bid_container">
<input id="auction_bid_input" type="text" maxlength="12"
class="middle nmr event-clear-focus"
name="bid_amount" value="Enter Bid"/>
<input id="updateBidButton" type="submit"
value="<?php echo $this->translate('Update'); ?>"
class="button grey-button num-items-button"/>
</span>
</div>
</div>
</form>
I am making a Ajax driven live search . But now I want to click the dropdown list to fill the html textbox. How can I modify my codes to include a function where the user can scroll through the results list using the up/down arrow keys. Here is the JavaScript code.
<script type="text/javascript">
function fill(Value) {
$('#name').val(Value);
$('#display').hide();
}
$(document).ready(function() {
$("#name").keyup(function() {
var name = $('#name').val();
if (name == "") {
$("#display").html("");
} else {
$.ajax({
type: "POST",
url: "ajax.php",
data: "name=" + name,
success: function(html) {
$("#display").html(html).show();
}
});
}
});
});
and here is the code in ajax.php page
if(isset($_POST['name'])) {
$name=trim($_POST['name']);
$query=mysqli_query($con,"SELECT * FROM mobile WHERE name LIKE '%$name%' LIMIT 0,5");
echo "<ul>";
while($query2=mysqli_fetch_array($query))
{ ?>
<div class="ajaxcontainer">
<li onclick='fill("<?php echo $query2[' name ']; ?>")'>
<a href="preview.php?id=<?php echo $query2['name']; ?>">
<div class="ajaximage">
<img src="<?php echo $query2['photo'];?>">
</div>
<div class="ajaxh1">
<h1><?php echo $query2['name']; ?></h1>
</div>
</a>
</li>
</div>
<?php } } ?>
good news.. after working 3 hours.. i got the solution to ur problem. Checkout the solution. let me know if you have any problems in this solution.I
<!DOCTYPE html>
<html>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<style type="text/css">
ul{
position: absolute;
top: 5px;
left: 36px;
list-style: none;
}
li{
border: 1px solid grey;
width: 202px;
margin: 0px;
}
input{
width:200px;
}
</style>
<script>
function showHint(str){
if(str=="" || !str){
$("ul").empty();
return;
}
$.ajax({
type: "GET",
url: "gethint.php",
data: "q="+str,
success: function(html) {
var names = html.split(",");
var listItems ="";
var dropDown =$("#dropDown");
dropDown.innerHTML="";
$("ul").empty();
names.forEach(name =>{
var li = document.createElement("li");
li.appendChild(document.createTextNode(name));
dropDown.append(li);
$("li").click(function(){
$("#txt1").val($(this).text());
});
});
}
});
}
</script>
<h3>Start typing a name in the input field below:</h3>
<form action="">
<div style="position:relative">
First name: <input type="text" id="txt1" onkeyup="showHint(this.value)">
<ul id="dropDown"></ul>
</div>
</form>
</body>
</html>
This is my php file.
<?php
require("connection.php");
$sql ="SELECT name FROM users";
$a=array();
// OR $a=[];
$result=$conn->query($sql);
if($result->num_rows > 0){
while($row = $result->fetch_assoc()){
$a[]=$row["name"];
//echo $row["name"];
}
}
else{
echo "No data to generate suggestions";
}
// get the q parameter from URL
$q = $_REQUEST["q"];
$hint = "";
// lookup all hints from array if $q is different from ""
if ($q !== "") {
$q = strtolower($q);
$len=strlen($q);
foreach($a as $name) {
if (stristr($q, substr($name, 0, $len))) {
if ($hint === "") {
$hint = $name;
} else {
$hint .= ", $name";
}
}
}
}
?>
I want to pass the value of my form_hidden from the view to a javascript function.
VIEW:
<?php echo validation_errors(); ?>
<?php
$mode = (isset($is_editing))? 'disabled' : 'disabled';
$client_name = (isset($is_editing))? $clientcontent->client_name : NULL;
$process = (isset($is_editing))? 'Edit' : 'Add';
$form_action = (isset($is_editing))? 'client/update_client/' . $id : 'client/create_client';
?>
<style type="text/css">
.check_exists
{
margin-top: 4px;
margin-left: 9px;
position: absolute;
width: 16px;
height: 16px;
}
</style>
<?php echo form_open($form_action, 'id="frm" class="form-horizontal" style="margin: 0;"'); ?>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h4 class="modal-title"><?php echo $process ?> Client</h4>
</div>
<div class="span6" style="padding-top:20px;padding-bottom:10px;">
<!-- Project Content Fields -->
<div class="control-group">
<p class="control-label">Client Name*</p>
<div class="controls">
<?php echo form_input('client_name', $client_name, 'id="client_name" style="height: 30px;"'); ?><span id="client_verify" class="check_exists" ></span>
</div>
</div>
<?php echo form_hidden('old_name',$client_name); ?>
</div>
<?php echo form_close(); ?>
<script type="text/javascript">
$(document).ready(function()
{
check_client("#client_name", "<?php echo base_url(); ?>client/check_availability", "#client_verify", "#old_name");
})
// </script>
Javascript File:
function check_client( id, url, spanid, old)
{
var oldname = $(old).val();
$('body').on('keyup', id, function(){
if($(id).val().length >= 3)
{
var newname = $(id).val();
console.info("The new name is " + newname + ":old name is" + oldname);
$.ajax({
url : url,
data : {client_name : $(id).val()},
type : 'POST',
success : function(data){
if( data.is_available == 0 ){ // Here
//start fading the messagebox
$(spanid).css({ "background-image": "url('http://localhost/mapmces_3.4.2/assets/img/no.png')" });
$(spanid).attr( "title", "Already Exists" );
available = false;
}else if( data.is_available ){ // Here the json response
//start fading the messagebox
$(spanid).css({ "background-image": "url('http://localhost/mapmces_3.4.2/assets/img/yes.png')" });
$(spanid).attr( "title", "Available" );
available = true;
}else{
alert("Some error occured! Check Console");
console.error(data.reason);
}
}
});
}
else
{
$(spanid).css({ "background-image": "none" });
}
});
}
Everything works fine. No errors are displayed by firebug. The function also works, but i want to add another validation which is checking if the oldname = newname. The function is able to get the value of the newname but it can't get the value of oldname which is from form_hidden.
Please tell me what I'm doing wrong. Many thanks!
What I would do is load the script in. after that, in your html, create some script tags and echo your form-hidden to a variable.
ex.
<script src='main.js'></script>
<script>
var hello=<?php echo form_Hidden; ?>;
thisIsAFunction(hello);
</script>
</body>
</html>
Just changed
<script type="text/javascript">
$(document).ready(function()
{
check_client("#client_name", "<?php echo base_url(); ?>client/check_availability", "#client_verify", "#old_name");
})
</script>
into
<script type="text/javascript">
var old_name = "<?php echo $client_name; ?>";
$(document).ready(function()
{
check_client("#client_name", "<?php echo base_url(); ?>client/check_availability", "#client_verify",old_name);
})
</script>