小编NEW*_*BIE的帖子

Jquery单选按钮提交值onclick

我目前正在开发我的网站:用户个人资料部分 - 选择个人资料图片; 在我的html结构中的位置是:

<tr>
 <td>
   <img src="a.jpg"><br>
   <input type="radio" name="profile" value="a" >
 </td>
 <td>
   <img src="b.jpg"><br>
   <input type="radio" name="profile" value="b" >
 </td>
</tr>
Run Code Online (Sandbox Code Playgroud)

我想要做的是使用jquery ajax提交值onchange但是我已经尝试了几种方法和测试,如:

$("input:radio[name='profile']").click(function(){
 alert($(this).val());
});
Run Code Online (Sandbox Code Playgroud)

$("input:radio[name='profile']").change(function(){
 alert($(this).val());
});
Run Code Online (Sandbox Code Playgroud)

仅供参考:我知道ajax部分我不知道如何接近onchange/onclick部分..请指导我开始

html ajax jquery radio-button

3
推荐指数
1
解决办法
8512
查看次数

Yii数据库迁移

大家好,我是yii框架工作的新手,我正在关注电子书上的拉里·奥尔曼的指示.我遇到的问题是:当我创建新的迁移时,我不断收到此错误

The migration directory does not exists:application.migrations

I use the command : $ yiic migrate create <name>
Run Code Online (Sandbox Code Playgroud)

谢谢你们帮助我理解你们.

migration yii

1
推荐指数
1
解决办法
2291
查看次数

Yii CDbCriteria将2个属性与单个值进行比较

嗨,我是yii的新手,我目前正在开展一个项目,我遇到了CDbCriteria问题.

我的目标查询是:

title LIKE '$_GET['search']%' OR description LIKE '$_GET['search']%'
Run Code Online (Sandbox Code Playgroud)

是否有可能使用CDbCriteria比较获得相同的结果?

控制器动作:

public function actionClassifieds(){
    $model = new Classifieds('search');
    $model->unsetAttributes();
    if(isset($_GET['category'])){
        if( $_GET['category'] == 0 ){
            $model->classified_category_id = '';
        }else{
            $model->classified_category_id = $_GET['category'];
        }
    }
    if(isset($_GET['search'])){
        $model->title = $_GET['search'];
        $model->description = $_GET['search'];
    }
    $this->render('classifieds',array('model'=>$model));
}
Run Code Online (Sandbox Code Playgroud)

我的模特:

public function search()
{
    // Warning: Please modify the following code to remove attributes that
    // should not be searched.

    $criteria=new CDbCriteria;

    $criteria->compare('classified_category_id',$this->classified_category_id);
    $criteria->compare('title',$this->title,true);
    $criteria->compare('description',$this->description,true);
    $criteria->compare('price',$this->price,true);
    $criteria->compare('timestamp',$this->timestamp);

    return new CActiveDataProvider($this, array(
        'criteria'=>$criteria,
        'pagination'=>array(
            'pageSize'=>10,
        ), …
Run Code Online (Sandbox Code Playgroud)

php sql database yii

1
推荐指数
1
解决办法
1万
查看次数

如何使用Socket.io和Node.js发出事件?

我发现很难发出一个事件,因为我不太了解创建一个事件/发出一个带有套接字IO的事件.

这是CASE"/ publish"的问题:

var app = http.createServer(function (req, res) {
    if (req.method == "OPTIONS") {
        res.header('Access-Control-Allow-Origin', '*:*');
        res.send(200);
    } else {

        var u = url.parse(req.url,true),
            body = '';

        req.on('data',function(chunk) {
            body += chunk;
        });

        req.on('end',function() {
            if(body) {
                var data =JSON.parse(body);
                if(data._app_secret && data._app_secret == 'nonexistent') {
                    switch(u.pathname) {
                        case '/generateusersecret' :
                            findTokenByUser(req.headers.host+'_'+data.user_id,function(reply) {
                                if(reply) {
                                    jsonResponse(res,{userSecret : reply});
                                } else {
                                    generateToken(req.headers.host + '_' + data.user_id,data.user_id,res);
                                }
                            });
                        break;
                        case '/getusersecret' :
                            findTokenByUser(req.headers.host + '_' + data.user_id,function(reply) {
                                jsonResponse(res,{userSecret …
Run Code Online (Sandbox Code Playgroud)

javascript websocket node.js socket.io

1
推荐指数
1
解决办法
7935
查看次数

Yii:服务器问题控制器操作总是找不到404

我目前正在开发我的网站应用程序,我需要在实时服务器上进行测试.

在本地计算机上它运行良好,但在实时服务器上它不起作用.

这是我的问题描述:

When I access the domain root folder "mydomain.com" it is working. 
It displays the
webpage index. But when I try to access site/action it 
gives me 404 not found. Same thing happens for other controller action.
Run Code Online (Sandbox Code Playgroud)

任何人都可以告诉我有什么问题.我不是真正服务器的专家所以我不擅长术语我只能描述正在发生的事情.

我不确定这是否值得一提,但我使用的是yii urlManager

有了这个设置

'urlManager'=>array(
            'urlFormat'=>'path',
            'rules'=>array(
                '<action:\w+>' => 'site/<action>',
                '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ),
            'showScriptName'=>false
        ),
Run Code Online (Sandbox Code Playgroud)

和根文件夹上的htaccess ..

服务器是:LAMP

非常感谢您的帮助..感谢所有人.

php lamp yii

0
推荐指数
1
解决办法
2340
查看次数

标签 统计

yii ×3

php ×2

ajax ×1

database ×1

html ×1

javascript ×1

jquery ×1

lamp ×1

migration ×1

node.js ×1

radio-button ×1

socket.io ×1

sql ×1

websocket ×1