嗨,我试图使用JQuery加载本地JSON文件来显示数据,但我得到一些奇怪的错误.我可以知道如何解决这个问题.
<html>
<head>
<script type="text/javascript" language="javascript" src="jquery-1.8.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
$.getJSON( "priorities.json" , function( result ){
alert(result.start.count);
});
});
</script></head>
</html>
Run Code Online (Sandbox Code Playgroud)
我只是提醒JSON数据的数量.我的JSON文件位于此html文件所在的目录中,JSON字符串格式如下所示.
{
"start": {
"count": "5",
"title": "start",
"priorities": [
{
"txt": "Work"
},
{
"txt": "Time Sense"
},
{
"txt": "Dicipline"
},
{
"txt": "Confidence"
},
{
"txt": "CrossFunctional"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
JSON文件名的priority.json和错误是
未定义未捕获的Referenceerror优先级
我试图改变提交按钮类型中文本的颜色,但是,我不知道为什么我无法更改它.
.button {
width: 105px;
height: 20px;
background-image: url('tiny.gif');
line-height: 20px;
padding-bottom: 2px;
vertical-align: middle;
font-family: "Lucida Grande", Geneva, Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
<!--font-weight: bold;
-->text-transform: none;
border: 1px solid transparent;
}
.button:hover {
background-image: url('tiny_.gif');
}Run Code Online (Sandbox Code Playgroud)
<input type="submit" value="Fetch" class="button" />Run Code Online (Sandbox Code Playgroud)
当我尝试更改提交按钮的颜色时,我遇到了问题.
我有一个以下格式的数组.这个数组有大约100个相同格式的元素.我想DOMPDF使用codeIgniter 使用库以特定格式的表格表示整个数组.
result = Array(
[0] => Array (
['brand'] => x,
['product'] =>p1,
['language']=>English,
);
[1] => Array (
['brand'] => x,
['product'] =>p2,
['language']=>English,
);
);
Run Code Online (Sandbox Code Playgroud)
我喜欢使用<table>标签以下面的格式表示它们html.
Brand x y
Product p1 p2
Language English English
Run Code Online (Sandbox Code Playgroud)
我在寻找想法.我有那些不超过100的数组元素.我想循环它们.
所以在下面的请求后我将发布我的代码.
<?php foreach($result as $res)
{
<table>
<tr>
<td>Brand</td>
<td><?php echo $res['brand'] ?></td>
</tr>
<tr>
<td>Product</td>
<td><?php echo $res['product'] ?></td>
</tr>
<tr>
<td>Language/td>
<td><?php echo $res['language'] ?></td>
</tr>
</table>
}
Run Code Online (Sandbox Code Playgroud)
这将为您提供这样的产品的输出.品牌x
产品p1
语言英语
我如何为其他产品做循环以获得我想要的输出?
注意:每个数组元素中不仅有3个字段.我有30多个领域.可能你认为我这样做只是因为PDF页面中的可打印区域.
嗨,我是新手学习laravel 4用于创建应用程序.我正在尝试使用laravel刀片将twitter bootstrap3文件链接到视图.我安装了一个新的laravel应用程序文件夹.
要从url路径中删除public,我删除了公用文件夹中的所有文件并保留在公用文件夹之外.我根据index.php文件中的上述更改更改了路径.根据我的需要,我的应用程序中将有两个部分,一个用于用户,另一个用于管理员.
所以为此我改变了我的routes.php文件,如下所示.
Route::get('/', 'HomeController@index');
Route::get('/admin', 'AdminController@index');
Run Code Online (Sandbox Code Playgroud)
我为用户创建了两个控制器,为管理员创建了另一个控制器,命名为HomeController和AdminController.这两个文件将如下所示.
HomeController for Users
<?php
class HomeController extends BaseController {
public function index()
{
return View::make('index');
}
}
AdminController for admin section
<?php
class AdminController extends BaseController {
public function index()
{
return View::make('admin.index');
}
}
Run Code Online (Sandbox Code Playgroud)
现在我在管理部分的views文件夹下创建了admin文件夹.这就是为什么admin.index当网址是这样的时候我一直打电话给管理员索引页面的原因http://localhost/laravel/admin.
现在我创建了资源文件夹,其中包含用于css文件的css文件夹,用于图像的js文件夹js文件和图像文件夹.我想将这些css和js文件链接到我的管理视图.所以我在layout.blade.php下面创建了一个.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Laravel</title>
<link rel="stylesheet" href="{{ asset('assets/css/bootstrap.css') }}">
<link rel="stylesheet" href="{{ asset('assets/css/style.css') }}"> …Run Code Online (Sandbox Code Playgroud) 我已经使用类别迁移创建了类别表,然后我尝试使用另一个迁移创建产品表,其中包含产品表中的外键关键字category_id到产品表中的id.
请在下面找到我的迁移.
Categories migration
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories',function(Blueprint $table)
{
$table->increments('id');
$table->string('category_name', 255);
$table->string('category_description', 255);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('categories');
}
}
Products migration
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProductsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function …Run Code Online (Sandbox Code Playgroud) 嗨,我正在开发我的应用程序时遇到一个大问题.实际上我们之前的应用程序类文件中已经开发了一个函数.现在我们想在新的应用程序中使用该函数.我们如何使用codeIgniter在我们的新控制器中调用该函数.
注意:我们的旧应用程序是在核心PHP中.
旧文件report.class.php ....在这里有一个函数名称get_report()
new controller ro_manager.php .......在这里有一个函数order_details()...
我想在get_report()函数中调用函数order_details()......我在这个任何想法都需要帮助.......
html ×3
codeigniter ×2
laravel ×2
laravel-4 ×2
php ×2
button ×1
css ×1
dompdf ×1
html-table ×1
javascript ×1
jquery ×1
json ×1