如何在ajax,PHP中的动态DIV中附加文本框字段

时间:2012-03-07 04:46:48

标签: php jquery ajax html

在我的页面中,我有一个标题文本框,复选框中列出了几个网站名称。 当我输入标题并选择任意1个网站时,它必须在meta_title文本框中显示标题,网站名称..它在动态DIV1 ..

现在复选框中列出的国家很少。当我选择任何一个国家时,它必须显示以前的文本框数据,如(标题,网站名称,选择的国家/地区名称)。这是一个过程..

现在我可以选择任何其他网站,它必须在meta_title文本框中显示标题,网站名称。它在动态DIV2中。这里只有一个条件,选择的国家/地区名称必须附加在D不是DIV中。

请帮帮我......谢谢..

3 个答案:

答案 0 :(得分:4)

$(wrapper).append("<div style='padding-top:5px;'>"+
"<a href='#' class='remove_field' title='Remove'><i class='fa fa-times-circle' style='color:#FF0000'></i></a>"+
    "<table>"+
    "<tr class='odd gradeX'>"+
        "<td style='width:7%;'>"+
        "<input type='text' name='txt_material[]' id='txt_material' value='<?=$sql_reqd[$rqdi]['PRDNAME']?>' class='form-control' placeholder='Material' data-toggle='tooltip' data-placement='top' data-original-title='Material' title='Material' maxlength='50' /><input type='hidden' name='txt_group[]' id='txt_group' value='"+x+"' class='form-control' maxlength='2' />"+   
        "</td>"+
    "</tr>"+
    "</table></div>");

答案 1 :(得分:4)

  GET http://www.myget.org/F/aspnetvnext/api/v2/FindPackagesById()?id='Microsoft.Framework.Configuration.EnvironmentVariables'
Warning: FindPackagesById: Microsoft.Framework.Configuration.EnvironmentVariables
  HTTP request timed out. Retrying.
  GET http://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Framework.Configuration.EnvironmentVariables'
Warning: FindPackagesById: Microsoft.Framework.Configuration.Ini
  HTTP request timed out. Retrying.
  GET http://www.myget.org/F/aspnetvnext/api/v2/FindPackagesById()?id='Microsoft.Framework.Configuration.Ini'
Warning: FindPackagesById: Microsoft.Framework.Configuration.Ini
  HTTP request timed out. Retrying.
  GET http://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Framework.Configuration.Ini'
Warning: FindPackagesById: Microsoft.Framework.Logging
  HTTP request timed out. Retrying.
  GET http://www.myget.org/F/aspnetvnext/api/v2/FindPackagesById()?id='Microsoft.Framework.Logging'
Warning: FindPackagesById: Microsoft.Framework.Logging
  HTTP request timed out. Retrying.
  GET http://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Framework.Logging'
Warning: FindPackagesById: Newtonsoft.Json
  HTTP request timed out. Retrying.
  GET http://www.myget.org/F/aspnetvnext/api/v2/FindPackagesById()?id='Newtonsoft.Json'
Warning: FindPackagesById: Newtonsoft.Json
  HTTP request timed out. Retrying.
  GET http://www.nuget.org/api/v2/FindPackagesById()?id='Newtonsoft.Json'
Error: FindPackagesById: Microsoft.AspNet.Mvc.Razor
  HTTP request timed out. Exiting.

$.ajax({
  url: url,
  success: function (data) {
    $(".content").append(data);
  }
});

答案 2 :(得分:3)

success: function(data) 
{
    var $inputDiv = "<input type="text" name="myname" value="" class='alert'/>
     $('#message').append($inputDiv);
}