hello…
I am new to Yii and ajax.
I have a form that doesn’t send the data with submition.
i want using ajax function to my system
can anybody help me
view.php
<?php $this->renderPartial("//layouts/_top", compact("title")); //breadcrumbs ?>
<!-- content main container -->
<div class="main">
<!-- row -->
<div class="row">
<!-- col 4 -->
<div class="col-md-4">
<!-- tile -->
<section class="tile transparent">
<!-- tile widget -->
<div class="tile-widget color transparent-white rounded-top-corners">
<div class="user-card">
<h3><strong><?= Yii::app()->user->profile->user_name ?></strong></h3>
<ul class="profile-controls inline">
<li class="mailto"><a href="#"><i class="fa fa-envelope"></i> Send Email</a></li>
<li class="avatar"><img src="<?= Yii::app()->baseUrl ?>/images/<?= Yii::app()->user->profile->user_profile_picture ?>" alt class="img-circle profile-photo"></li>
<li class="callto" id="make-call">
<a href="#">
<span class="call">Call <i class="fa fa-phone"></i></span>
<span class="calling">Calling... <i class="fa fa-microphone"></i></span>
</a>
</li>
</ul>
<h2><center><?= $role_name ?></center></h2>
<h5><?= $dept_name ?></h5>
<div class="social-networks">
<a href="http://www.facebook.com"><i class="fa fa-facebook-square"></i></a>
<a href="http://www.googleplus.com"><i class="fa fa-google-plus-square"></i></a>
<a href="http://www.twitter.com"><i class="fa fa-twitter"></i></a>
</div>
</div>
</div>
<!-- /tile widget -->
</section>
<!-- /tile -->
</div>
<!-- /col 4 -->
<!-- col 8 -->
<div class="col-md-8">
<!-- tile -->
<section class="tile transparent">
<!-- tile widget -->
<div class="tile-widget nopadding color transparent-black rounded-top-corners">
<!-- Nav tabs -->
<ul class="nav nav-tabs tabdrop">
<li class="active"><a href="#profile-tab" data-toggle="tab">Profile</a></li>
<li><a href="#password-tab" data-toggle="tab">Password</a></li>
</ul>
<!-- / Nav tabs -->
</div>
<!-- /tile widget -->
<!-- tile body -->
<div class="tile-body tab-content rounded-bottom-corners">
<!-- Tab panes -->
<div id="profile-tab" class="tab-pane fade in active">
<form>
<div class="row">
<div class="form-group col-md-12 legend">
<h4><strong>Personal</strong> Settings</h4>
<p>Your personal account settings</p>
</div>
</div>
<!--form 1-->
<div class="row">
<div class="form-group col-sm-12">
<label for="first-name">Name</label>
<input type="text" class="form-control" id="name" placeholder="<?= Yii::app()->user->profile->user_name ?>">
</div>
</div>
<!--form 2-->
<div class="row">
<div class="form-group col-sm-6">
<label for="user_nric">Ic Number</label>
<input type="text" class="form-control" id="ic_no" placeholder="<?= Yii::app()->user->profile->user_nric ?>">
</div>
<div class="form-group col-sm-6">
<label for="staff_no">Staff No</label>
<input type="text" class="form-control" id="zip" placeholder="<?= Yii::app()->user->profile->staff_no ?>">
</div>
</div>
<!--form 5-->
<div class="row">
<div class="form-group col-sm-6">
<label for="email">E-mail</label>
<input type="text" class="form-control" id="email" placeholder="<?= Yii::app()->user->profile->user_email ?>">
</div>
<div class="form-group col-sm-6">
<label for="contact_no">Contact No</label>
<input type="text" class="form-control" id="phone" placeholder="<?= Yii::app()->user->profile->user_contact_no ?>">
</div>
</div>
<!--form 6-->
<div class="row">
<div class="form-group col-sm-6">
<label for="avatar">Profile Image</label>
<div class="input-group">
<span class="input-group-btn">
<span class="btn btn-primary btn-file">
<i class="fa fa-upload"></i><input type="file" multiple="">
</span>
</span>
<input type="text" class="form-control" readonly="" id="profile image">
</div>
<span class="help-block">Allowed files: gif, png, jpg. Max file size 1Mb</span>
</div>
</div>
<!--form 7-->
<label for="bio">Bio</label>
<div class="profile-form">
<textarea class="form-control" placeholder="Say something?" rows="5"></textarea>
<div class="post-toolbar">
<a href="#" title="Add File"><i class="fa fa-paperclip"></i></a>
<a href="#" title="Add Image"><i class="fa fa-camera"></i></a>
</div>
</div>
<!--form 8-->
<div class="row">
<div class="col-sm-offset-4 col-sm-8">
<button type="save" name="save" class="btn btn-greensea">Save</button>
<button type="reset" class="btn btn-red">Reset</button>
</div>
</div>
</form>
</div>
<!--tab2-->
<div id="password-tab" class="tab-pane fade in">
<form>
<div class="row">
<div class="form-group col-md-12 legend">
<h4><strong>Security</strong> Settings</h4>
<p>Secure your account</p>
</div>
</div>
<!--form 1-->
<div class="row">
<div class="form-group col-sm-6">
<label for="username">Username</label>
<input type="text" class="form-control" id="username" value="" >
</div>
<div class="form-group col-sm-6">
<label for="password">Current Password</label>
<input type="password" class="form-control" id="password" value="">
</div>
</div>
<!--form 2-->
<div class="row">
<div class="form-group col-sm-6">
<label for="new-password">New Password</label>
<input type="password" class="form-control" id="new-password">
</div>
<div class="form-group col-sm-6">
<label for="new-password-repeat">New Password Repeat</label>
<input type="password" class="form-control" id="new-password-repeat">
</div>
</div>
<!--form 3-->
<div class="row">
<div class="col-sm-offset-4 col-sm-8">
<button type="save" name="save" class="btn btn-greensea">Save</button>
<button type="reset" class="btn btn-red">Reset</button>
</div>
</div>
</form>
</div>
<!-- /tile body -->
</div>
<!-- /col 8 -->
</section>
<!-- /tile -->
</div>
<!-- /row -->
</div>
<!-- /content container -->
<script>
//initialize file upload button function
$(document)
.on('change', '.btn-file :file', function () {
var input = $(this),
numFiles = input.get(0).files ? input.get(0).files.length : 1,
label = input.val().replace(/\\/g, 'http://tattek.sk/').replace(/.*\//, '');
input.trigger('fileselect', [numFiles, label]);
});
$(function () {
$('#make-call a').click(function () {
$(this).toggleClass('active');
});
$('.post-toolbar a').tooltip({
placement: 'top',
trigger: 'hover',
html: true,
container: 'body'
});
$('.task-controls .mark').click(function () {
$(this).toggleClass('marked');
});
//accordion class active toggling
$('.task-list .panel-heading .task-toggle').click(function () {
var $previous = $('.task-list .panel.active');
$previous.removeClass('active');
$(this).parent().parent().stop().addClass('active');
if ($(this).parent().parent().hasClass('active')) {
$previous.removeClass('active');
}
});
//chosen select input
$(".chosen-select").chosen({disable_search_threshold: 10});
//initialize file upload button
$('.btn-file :file').on('fileselect', function (event, numFiles, label) {
var input = $(this).parents('.input-group').find(':text'),
log = numFiles > 1 ? numFiles + ' files selected' : label;
console.log(log);
if (input.length) {
input.val(log);
} else {
if (log)
alert(log);
}
});
})
</script>
what coding that i must put in contorller?
i want the save button function and update from database.