Hi Everyone,
When i clicked delete button this js function has called.
function RemoveFavorite(obj)
{
if (confirm('Ürün Favorilerizden Çıkarılacak. Emin Misiniz?')) {
$.ajax({
type: 'POST',
data: {userFavoriteId: obj},
url: '/testdrive/index.php/shopping/RemoveFavorite',
success: function(data) {
$('#userFavDiv').html(data);
},
error: function(data)
{
alert('Onaylanmadı!!');
}
});
}
}
.
in shopping/RemoveFavorite method like that:
public function actionRemoveFavorite() {
$Id = $_POST['userFavoriteId'];
$model = UserFavorite::model()->findbyPk($Id);
$model->delete();
echo CJSON::encode($this->renderPartial('/shopping/userFavorite'),true,false);
}
.
json::encode function return me like response:
<meta charset="utf-8">
<section class="other-books subsection divider-top-thick">
<h3>Favoriler</h3>
<table class="table table-striped table-header">
<tr style='background-color: #999999'>
</tr>
<tbody>
<tr>
<td>
<a href="/testdrive/index.php/book/bookDetail?bookId=1">URSULE MIROUET</a>
</td>
<td>
<a class="cart-item-remove-option icon-trash" title='Favorilerden Çıkar' href="#" onclick="RemoveFavorite('59');">
</a>
</td>
</tr>
</tbody>
</table>
</section>
<script>
function RemoveFavorite(obj)
{
if (confirm('Ürün Favorilerizden Çıkarılacak. Emin Misiniz?')) {
$.ajax({
type: 'POST',
data: {userFavoriteId: obj},
url: '/testdrive/index.php/shopping/RemoveFavorite',
success: function(data) {
$('#userFavDiv').html(data);
},
error: function(data)
{
alert('Onaylanmadı!!');
}
});
}
}
</script>null
.
Did you see null string which is end of the respond. Dou you know why respond have null string?