日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

ajax查询返回字符串,从CFC返回结果之前,对AJAX查询执行字符串函数

發(fā)布時(shí)間:2025/4/5 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ajax查询返回字符串,从CFC返回结果之前,对AJAX查询执行字符串函数 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

||

我的頁面的頂部\'A-Z \'中包含字母。當(dāng)用戶單擊字母時(shí),我將對(duì)CFC進(jìn)行AJAX調(diào)用,該CFC將根據(jù)所選字母對(duì)縮略圖目錄進(jìn)行查詢,并返回相應(yīng)文件名的列表。

當(dāng)列表返回到頁面上的函數(shù)時(shí),我正在使用split()對(duì)文件名執(zhí)行多項(xiàng)功能以提取某些信息。例如,文件名的格式如下:lastname_firstnameIMG_1234_RGB.jpg

我的目標(biāo)是提取CFC中的姓氏,名字和號(hào)碼,以便我可以標(biāo)記縮略圖圖像并創(chuàng)建指向\'real \'文件的鏈接以供下載,例如lastname_firstnameIMG_1234_CMYK.tif等。

最初,我建立了AJAX函數(shù)以使用split()處理返回的列表,但I(xiàn)E中出現(xiàn)錯(cuò)誤。為了緩解此問題,我寧愿在CFC中執(zhí)行字符串函數(shù)并返回準(zhǔn)備就緒的數(shù)據(jù)。

返回?cái)?shù)據(jù)結(jié)構(gòu)之前,如何在CFC中執(zhí)行字符串函數(shù)?

編輯此設(shè)置在Safari和FF中享有盛譽(yù),但在IE中產(chǎn)生了錯(cuò)誤。我嘗試修改split()函數(shù),并取得了一些成功,但是,當(dāng)然,它在FF中無法正常工作。同樣,我的目標(biāo)是消除JavaScript字符串mod,并在CFC中進(jìn)行操作。

這是我的CFC:

action=\"list\"

directory=\"#thumbsdir#\"

recurse=\"true\"

listinfo=\"name\"

name=\"qFile\"

filter=\"#local.data#\"

/>

和我的AJAX函數(shù)(包裝在document.ready函數(shù)中...):

$(\'.lastname\').click(function(e){

e.preventDefault();

$(\'#emptymessage\').hide();

$(\'#searching\').show();

$(\'#content\').html(\"\");

var alpha = $(this).attr(\'id\');

$.getJSON(\"cfcengine.cfc?method=List&returnformat=json&queryFormat=column\",

{letter:alpha},

function(res, code) {

var s = \"\";

if(res.message.ROWCOUNT > 0) {

$(\'#searching\').hide();

for(var i=0; i

//This is all the stuff I want to get rid of...

var theFile = res.message.DATA.Name[i]

var theLastName = theFile.split(/_(.+)/)[0];

var theRest = theFile.split(/_(.+)/)[1];

var theFirstNameAll = theRest.split(/_(.+)/)[0];

var theFirstName = theFirstNameAll.split(/(?:IMG)/)[0];

var theImageAll = theRest.split(/_(.+)/)[1];

var theImage = theImageAll.split(/_(.+)/)[0];

var bw = theLastName + \'_\' + theFirstName + \'IMG_\' + theImage + \'_BW.jpg\';

var rgb = theLastName + \'_\' + theFirstName + \'IMG_\' + theImage + \'_RGB.jpg\';

//Right now I\'m just returning the name to the page until debugging is complete...

s += \'

\' + res.message.DATA.Name[i] + \'\';

}

} else {

var s = \"Sorry, nothing matched your search.\";

}

$(\"#content\").html(s);

//End response

}

//End getJSON

);

//End plist click function

});

總結(jié)

以上是生活随笔為你收集整理的ajax查询返回字符串,从CFC返回结果之前,对AJAX查询执行字符串函数的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。