我的VIEW中有这样的PHP代码:
<tbody>
<?php $i=1; foreach ($kelas_kuliah as $val): ?>
<tr>
<td>
<?php site_url('/admin/cdtkelas_kuliah/get_id_sms/'.$val->kdpsttrak);?>
</td>
</tr>
<?php $i++; endforeach; ?>
它应该返回这样的值:
7678c279-0656-4458-968e-9a1c5a8b0fdb
这是我的控制器:
public function get_id_sms($prmkode_prodi){
$client = new SoapClient($this->wsdl);
$username = '******';
$password = '******';
$token = $client->GetToken($username, $password);
$prmtable = 'sms';
$prmfilter = "kode_prodi like '".$prmkode_prodi."'";
$get_record = $client->GetRecord($token,$prmtable,$prmfilter);
echo $get_record->result->id_sms;
}
但是当我跑它时,它什么也没显示,为什么?感谢。
答案 0 :(得分:2)
它没有显示任何内容,因为您错过了$(document).ready(function() {
$(".btn-default").on('click', function() {
var $this = $(this),
$num = $this.parent('li').find('> .num');
$this.html("<span class='glyphicon glyphicon-arrow-up' aria-hidden='true' style='color:orange'></span>");
if ($this.val() !== 'voteUp') {
return;
}
if ($this.hasClass("questionButton")) {
var buttonType = "questionButton";
}
// else if ?
if ($this.hasClass("answerButton")) {
var buttonType = "answerButton";
}
var currentScore = parseInt($num.text()) || 0,
currentID = $num.attr('id');
$num.html(currentScore + 1);
// AJAX script to send the voteScore to the controller and then put it into the DB
$.ajax({
type: 'POST',
url: '@routes.Application.voteUp()',
data: {
questionID: currentID,
score: currentScore,
type: buttonType
},
success: function(data) {}
});
});
});
。请参阅更新的代码
echo
已编辑:如果您只想要值
,请尝试此操作<td>
<?php echo site_url('/admin/cdtkelas_kuliah/get_id_sms/'.$val->kdpsttrak);?>
^^^^^
</td>