小编Sky*_*man的帖子

jQuery AJAX - 意外的令牌+ parsererror

我今天用jQuery和AJAX写了一个脚本,我得到了一些错误......

剧本:

function changeAdmin(id) {
$(document).ready(function() {
    $('#ta-modarea-'+id).fadeOut('fast');
    $('#ta-m-loading-'+id).fadeIn('fast');

    $.ajax({
        type: 'POST',
        url: 'ajax_utf.php?a=changeteamadmin',
        dataType: 'json',
        data: {
            admin : $('#admin-id-'+id).val()
        },
        success: function(data) {
            $('#ta-m-loading-'+id).fadeOut('fast');
            $('#ta-modarea-'+id).text(data.msg).fadeIn('fast');
        },
        error: function(jqXHR, textStatus, errorThrown) {
            $('#ta-m-loading-'+id).fadeOut('fast');
            $('#ta-modarea-'+id).text('HTTP Error: '+errorThrown+' | Error Message: '+textStatus).fadeIn('fast');
        }
    });

    return false;
});
}
Run Code Online (Sandbox Code Playgroud)

运行后,我收到此错误消息: HTTP Error: SyntaxError: Unexpected token < | Error Message: parsererror

你能帮帮我吗,我该怎么办?

ajax jquery xmlhttprequest parse-error

15
推荐指数
2
解决办法
4万
查看次数

将.htaccess转换为nginx(mod_rewrite)

我的apache有以下.htaccess文件:

<IfModule mod_rewrite.c>
  Options +FollowSymlinks    
# Options +SymLinksIfOwnerMatch
  RewriteEngine On
  RewriteBase /
  RewriteRule ^$          index.php       [L]
  RewriteCond %{REQUEST_FILENAME}         !-f
  RewriteCond %{REQUEST_FILENAME}         !-d
  RewriteRule (.*)        index.php?page=$1  [QSA,L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

突然,我不得不将我的网络服务器更改为nginx,我不知道为什么,但mod重写不起作用.

我使用在线'转换器'来转换它,所以我有以下内容:

location / {
  rewrite ^/$ /         index.php       break;
  if ($request_filename ~         !-f){
    rewrite ^(.*)$ /       index.php?page=$1   break;
  }
}
Run Code Online (Sandbox Code Playgroud)

你能帮我解决什么问题吗?

在此先感谢Marcell

apache .htaccess mod-rewrite nginx

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

CSS - HTML - 2个浮点列

我遇到了一个问题.

我的代码现在:

<div style="width: 500px; margin: auto; border: 1px solid black;">
   <div style="float: left; border: 1px solid black;"><b><u>TEST</u></b></div>
   <div style="float: left; margin-left: 20px; border: 1px solid black;">A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A …
Run Code Online (Sandbox Code Playgroud)

html css css-float

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

带和的jQuery选择器

我不知道我的问题的好标题,这就是为什么我没有搜索.

我的问题如下:

我有一个HTML代码,例如:

<input type="text" id="product_qty_1" value="12" />
<input type="text" id="product_qty_2" value="21" />
<input type="text" id="product_qty_3" value="45" />
Run Code Online (Sandbox Code Playgroud)

我想通过jQuery对值进行求和,但这需要是自动的,因为我们无法知道有多少inputs.

我不知道,如何处理选择器input[id*="product_qty_"]以使其工作,并对值进行求和!

提前致谢!

html javascript jquery sum

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

PHP:获取命令的LINUX PID

我在我的linux服务器(Ubuntu)中运行命令.例如:

screen -A -h 1500 -m -dmS test_command_one /home/SKY-users/SKY-001/./script
Run Code Online (Sandbox Code Playgroud)

这个后台进度的PID是否有任何方法,屏幕名称是:test_command_one

ps aux | grep test_command_one:

root      6573  8.1  2.4 271688 123804 pts/4   Ss+  Oct19   3:04 /home/SKY-users/SKY-001/./ ...
Run Code Online (Sandbox Code Playgroud)

我想回到这个PID: 6573

PHP :(简单)

<?php 
$output = shell_exec('sudo ps aux | grep test_command_one');
$array = explode("\n", $output);
echo '<pre>'.print_r($array, true).'</pre>';
?>
Run Code Online (Sandbox Code Playgroud)

感谢帮助!

php linux ubuntu

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