小编Jud*_*tsu的帖子

如何通过jQuery将PHP文件加载到DIV中?

我正在开发一个网站,我在侧面菜单上有这个:

<a href="#" class="leftMenu" id="contact">Contact Us</a>

然后我有这个脚本

$(document).ready(function(){
  $("#contact").click(function(){
    $("#contents").load('home.php');
  });
});
Run Code Online (Sandbox Code Playgroud)

我在我的页面中有这个DIV:

<div class="contentWrapper" id="contents"></div>

显然,我想要做的是在我点击联系我们超链接时加载home.php,这不起作用.我的代码出了什么问题?

javascript php ajax jquery

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

遍历PHP中的CSV文件

我有这个代码:

<?php
   $handle = fopen("GeneratePicklist.csv", "r");
   $data = fgetcsv($handle, 5000, ",");
?>
Run Code Online (Sandbox Code Playgroud)

这会打开一个php文件并将其转换为php数组.然后我将列出数组内容并将它们显示为格式化页面.我有这个代码,它正在工作.

<?php
    echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
        <tr>
            <td class=\"dataHeader\" width=\"100\">Mat.Loc.</td>
            <td class=\"dataHeader\" width=\"20\">Qty</td>
            <td class=\"dataHeader\">Description</td>
            <td class=\"dataHeader\" width=\"150\">Part Number</td>
            <td class=\"dataHeader\" width=\"30\">Multiplier</td>
            <td class=\"dataHeader\" width=\"80\">Total Qty</td>
        </tr>
";
$locatePartNoString = array_search("Part Number",$data);
$arrayStart = $locatePartNoString-1;
end($data);
$lastField = key($data);
$counter = ($lastField - $arrayStart);
$arrayBegin = $locatePartNoString+6;
while($counter>0) {
    echo "
        <tr>
            <td class=\"centered\"><span class=\"title\">*".$data[$arrayBegin+4]."*</span><br>".$data[$arrayBegin+4]."</td>
            <td id=\"qty".$counter."\" class=\"centered\">".$data[$arrayBegin+1]."</td>
            <td>".$data[$arrayBegin+2]."</td>
            <td class=\"centered\">".$data[$arrayBegin]."</td>
            <td class=\"centered\"><input type=\"text\" id=\"multiplier".$counter."\" name=\"multiplier".$counter."\" …
Run Code Online (Sandbox Code Playgroud)

php csv counter loops while-loop

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

标签 统计

php ×2

ajax ×1

counter ×1

csv ×1

javascript ×1

jquery ×1

loops ×1

while-loop ×1