用jquery返回css格式化的coldfusion结果

Pat*_*urg 1 css coldfusion jquery

好吧,所以我做了这个jquery,结果很好,但是css没有得到应用.有没有办法将css应用于结果?

function doSearch() {
//Send the AJAX call to the server
  $.ajax({
  //The URL to process the request
    'url' : 'cf/inventoryQuery.cfm',
  //The type of request, also known as the "method" in HTML forms
  //Can be 'GET' or 'POST'
    'type' : 'POST',
  //Any post-data/get-data parameters
  //This is optional
    'data' : $("#SearchInventory").serialize(),
  //The response from the server
    'success' : function(data) {
        $('#Results').html(data);
    }
  });
}
Run Code Online (Sandbox Code Playgroud)

编辑 - 这是获取新内容的div

<div id="Results" >
    <cfoutput query="queryCars" maxrows="4">
        <div class="Result">
            <img src="images/samplecar.png"  />
            <div class="ResultText">
               #strYear# #strMake# #strModel#
        </div>
        </div>
    </cfoutput>
</div>
Run Code Online (Sandbox Code Playgroud)

从AJAX调用返回的结果如下所示

    <cfoutput query="queryCars" maxrows="4">
        <div class="Result">
            <img src="images/samplecar.png"  />
            <div class="ResultText">
                #strYear# #strMake# #strModel#
         </div>
        </div>
    </cfoutput>
Run Code Online (Sandbox Code Playgroud)

所以它实际上用完全相同的东西取代了一件事.我的呼叫页面在标题中有一个.

Hen*_*nry 5

ajax调用看起来像是从CF返回HTML.所以基本上,你有2个选择.

  1. <style>标记内生成css 并将其与查询表一起返回.
  2. 在调用者页面中包含css文件,并确保生成的结果.cfm使用相同的预定义类.