ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/add-blog.php |
<?php include "header.php";?> <div class="content-wrapper" style="background:white;"> <div class="clearfix"></div> <section class="content"> <div class="row"> <div class="col-xs-12"> <div class="box-header"> <h3 class="box-title"><b>Add New Blog: </b></h3> </div> <div class="box-body"> <div class="col-lg-12"> <div id="content-div"> <form action="" id="add_blog_form" enctype="multipart/form-data" method="post" accept-charset="utf-8"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label class="required" for="heading">Blog Name</label> <input type="Text" name="name[]" id="name" value="" placeholder="Enter name" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="heading">Blog Author</label> <input type="Text" name="heading[]" id="heading" value="" placeholder="Enter Heading" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="tag_line">Blog Tag Line</label> <input type="Text" name="tag_line[]" id="tag_line" value="" placeholder="Enter Tag Line" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="date">Blog Date</label> <input type="date" name="date[]" id="date" value="" placeholder="Enter Date" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="image">Thumpnail Image Size (WIDTH :720p ,HEIGHT 698p) </label> <input type="file" name="image[]" id="image" value="" placeholder="Enter Image" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="image">Blog Image Size (WIDTH :770px ,HEIGHT 310px) </label> <input type="file" name="blog_image[]" id="blog_image" value="" placeholder="Enter Image" class="form-control tip" autocomplete="off" /> </div> </div> <div class="col-md-12"> <div class="form-group"> <label class="required" for="content">Blog Conten</label> <textarea name="content" id="editor1"></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="description">Description *</label> <input type="text" name="description" id="description" value="" placeholder="Enter description" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="title">Title *</label> <input type="text" name="title" id="title" value="" placeholder="Enter title" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="keyword"> Keyword * </label> <input type="text" name="keyword" id="keyword" value="" placeholder="Enter keyword" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div id="add_blog_row"></div> <div class="col-md-12" style="display: flex;justify-content: center;margin-top: 3%;"> <div class="form-group"> <input type="submit" id="add_standard" name="add_standard" value="Add Blog" class="btn btn-success" /> </div> </div> </div> <div id="loading-div" style="display: none;"> <img src="images/gif/successfull.gif" style="margin-left: 37%;width: 25%;padding-bottom: 5%;"> </div> <div class="form-group" style="text-align:center;"> <a href="add-blog.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a> <a href="blog.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a> </div> <div class="clearfix"></div> </form> </div> </div> </div> </div> <div class="row"> </section> <script src="https://cdn.ckeditor.com/ckeditor5/34.0.0/classic/ckeditor.js"></script> <script> ClassicEditor .create(document.querySelector('#editor1')) .catch(error => { console.error(error); }); </script> <script> $(document).on('click', '.remove_class', function(){ $(this).closest('.row').remove(); }); $('#add_row').on('click', function() { var row = `<div class="row"> <div class="col-md-6"> <div class="form-group"> <label class="required" for="heading">Blog Heading</label> <input type="Text" name="heading[]" id="heading" value="" placeholder="Enter Heading" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="tag_line">Blog Tag Line</label> <input type="Text" name="tag_line[]" id="tag_line" value="" placeholder="Enter Tag Line" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="date">Blog Date</label> <input type="date" name="date[]" id="date" value="" placeholder="Enter Date" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="content">Blog Contenn</label> <textarea type="text" name="content" id="content" placeholder="Enter Content" class="form-control tip" required="required"></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="image">Blog Image</label> <input type="file" name="image[]" id="image" value="" placeholder="Enter Image" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <span class="remove_class btn btn-danger" style="font-weight: 800;border: 1px solid beige;border-radius: 20px;margin-top: 25px;">Delete Row</span> </div>`; $("#add_blog_row").append(row); }); </script> <script> $('#add_blog_form').on('submit', function(e){ console.log("Click And Form Working"); e.preventDefault(); $('#content-div').hide(); $('#loading-div').show(); var formData = new FormData(this); formData.append('type', 'blog_form'); $.ajax({ url: 'add-api/add-blog-form.php', type: 'post', dataType: 'json', data: formData, cache: false, contentType: false, processData: false, enctype: 'multipart/form-data', success: function (response) { console.log(response); if(response['status']==200){ alert(response['message']); $('#add_blog_form').trigger("reset"); $('#loading-div').hide(); $('#content-div').show(); }else{ alert(response['message']); $('#loading-div').hide(); $('#content-div').show(); } } }); }); </script> <?php include "footer.php";?>