Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to append a text box field in dynamic DIV in ajax, PHP

In my page, I had a text box for title and few website names are listed in the checkbox.. When I enter the title and choose any 1 website means, it must display the title, website name in the meta_title text box.. Its in dynamic DIV1..

And Now few countrys are listed inthe check box.. When I choosed any 1 country, it must display the previous text box data like (title, website name, choosen country names). Upto this is in a process..

Now I can choose any other website, it must display the title, website name in the meta_title text box.. Its in dynamic DIV2.. Here only one condition, the choosen country names must be append in n no of DIVs..

Please Help me.. Thanks..

like image 281
Arun Rama Balan.G Avatar asked Mar 07 '12 04:03

Arun Rama Balan.G


3 Answers

$(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>");
like image 105
Arun Rama Balan.G Avatar answered Oct 17 '22 00:10

Arun Rama Balan.G


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

or

$("div").append($("<div>").load(url));
like image 37
Jamal Rahani Avatar answered Oct 17 '22 01:10

Jamal Rahani


success: function(data) 
{
    var $inputDiv = "<input type="text" name="myname" value="" class='alert'/>
     $('#message').append($inputDiv);
}
like image 3
Gurpal singh Avatar answered Oct 17 '22 00:10

Gurpal singh