vendredi 5 juillet 2019

create html tag after ajax request

how to create html tag after ajax request

here is my code so far

$('#mainSkillSelect').change(function()
        {
            var id_mainSkill = $(this).val();
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
                });
            $.ajax(
                {
                    type: 'POST',
                    url: '',
                    dataType : 'json',
                    data: 'id_mainSkill=' + id_mainSkill,
                    success: function(response)
                    {
                        $.each(response, function() {
                            console.log(response);
                        });
                    }
                });
        });


<div class="col-12">
    <div class="form-group">
        <label for="mainSkill">Main Skill</label>
        {!! Form::select('id_mainSkill', $mainSkill, null, ['class' => 'form-control', 'id'=>'mainSkillSelect','required', 'placeholder' => '-- Select Main Skill --']) !!}
    </div>
</div>


<div class="col-12">
    <div class="row">
        <div class="col">
            <div class="form-check">
                <input class="form-check-input" type="checkbox" name="Specialisation" value="Full-Remote">
                <label class="form-check-label">
                    UI/UX
                </label>
            </div>
        </div>
        <div class="col">
            <div class="form-group">
                <select name="mainSkill" class="form-control">
                    <option value="< 1 Year"> &lt; 1 Year </option>
                    <option value="> 1 Year"> &gt; 1 Year </option>
                    <option value="2 Year"> 2 Year </option>
                    <option value="3 Year"> 3 Year </option>
                    <option value="4 Year"> 4 Year </option>
                    <option value="5 Year"> 5 Year </option>
                    <option value="> 5 Year"> &gt; 5 Year </option>
                </select>
            </div>
        </div>
    </div>
</div>

how to loop data after code with some data from ajax request

here is what i got after ajax success ["UI/UX", "UI Designer", "UX Researcher", "Product Designer"]

how to apply response to html code ?

example



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire