AbdulBazith

Experience

5,690

0 Best Reply Awards

  • Member Since 3 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

18th August, 2018

AbdulBazith left a reply on How To Use Form Tag In Ajax Return In Laravel? • 1 day ago

@tykus

One doubt, actually i have replaced the content of tbody after my ajax search so the searched item is displayed as per your suggestion. it worked correctly

then why cant i replace the pagination also


div class="text-center">   

    {!! $loc->Links(); !!}

</div>

see the above section is displayed before search.

After change why cant i replace this pagination s that my search result pagination content only will be displayed am i right??

why i am saying this is because, i no need of moving my search result to page without refresh

instead if i replace the pagination then whenever i search a content pagination will be for that content only that's what i expected

is there any idea??

AbdulBazith left a reply on Ajax With Seach Pagination In Not Working Laravel • 1 day ago

@pardeepkumar @Sergiu17 @zion @crnkovic @jlrdw

One doubt, actually i have replaced the content of tbody after my ajax search so the searched item is displayed .

then why cant i replace the pagination also


div class="text-center">   

    {!! $loc->Links(); !!}

</div>

see the above section is displayed before search.

After change why cant i replace this pagination s that my search result pagination content only will be displayed am i right??

why i am saying this is because, i no need of moving my search result to page without refresh

instead if i replace the pagination then whenever i search a content pagination will be for that content only that's what i expected

is there any idea??

17th August, 2018

AbdulBazith left a reply on Ajax With Seach Pagination In Not Working Laravel • 1 day ago

@pardeepkumar @Sergiu17


$('#location,#area,#booth').on('keyup',function(){ 
        $.ajax({
        type : 'get',

        url : '{{URL::to('search_location_details')}}',

        data:{
                'location': $('#location').val(),
                'area': $('#area').val(),
                'booth': $('#booth').val()
        },

        success:function(data)
        {
            console.log(data);
              $('#results').html(data);

        }

        });
        })


this is what i am passing from my ajax..

can you say where i should add your coding @pardeepkumar

AbdulBazith left a reply on Ajax With Seach Pagination In Not Working Laravel • 1 day ago

@crnkovic ya let me try. tomorrow itself i need to finish it,,

i need to refer tutorial for that and i will try it, thank you for your reply.

If you don't mind can can you kindly share the appropriate video link for my problem in vue.js

AbdulBazith left a reply on Ajax With Seach Pagination In Not Working Laravel • 2 days ago

@crnkovic thankz for your reply.

ya what you said is right. what i expect is after my search only the search records and the pagination for that search records must be displayed.

say for example after search the result contain 8 records means, i give paginate(5) in my search controller. so only two pages with 5 + 3 must be displayed..

but my old pagination before search is displayed.

based on my search my pagination should also change..

thats what i expect..

AbdulBazith left a reply on Ajax With Seach Pagination In Not Working Laravel • 2 days ago

@Sergiu17 thankz for your reply, let me try and reply,,

AbdulBazith left a reply on Ajax With Seach Pagination In Not Working Laravel • 2 days ago

@zion

most of the times i refer google. but iam new to laravel so sometimes i cant understand. in this threads some one will answer with explanation. that would help me improve my project as well as knowledge.

actually i am in dead end of my project that's why asked this question.

see my thread past 10 threads speaks about this pagination only.

pagination problem with this ajax is some what tedious task for me

kindly dont mistake me..

16th August, 2018

AbdulBazith started a new conversation Ajax With Seach Pagination In Not Working Laravel • 2 days ago

Guys i am working with a project

i am using search inajax

This is my controller before search

 public function index()
    {

        $loc=Location_details::orderBy('created_at','desc')->paginate(10);
        return view('Location_details.view')->withloc($loc);

    }

This is my partials 'tbody'


        @foreach($loc as $locs)
            <tr>
                <td>{{ $locs->ven_loc }}</td>
                <td>{{ $locs->ven_area }}</td>
                <td>{{ $locs->ven_booth }}</td>
<td>

        {!! Form::open(['route'=>['Location_details.destroy',$locs->id], 'onsubmit' => 'return ConfirmDelete()','method'=>'Delete']) !!}
    <a href="{{ route('Location_details.edit',$locs->id) }}" class="btn btn-info glyphicon glyphicon-edit"></a>

    <button type="submit" class="btn btn-info glyphicon glyphicon-trash">
        </button>
</td>

{!! Form::close() !!}
     </tr>
        @endforeach

This is my view


 <tbody id="results">
        @include('Location_details.tbody')
    </tbody>

  </table>

        <div class="text-center">

            {!! $loc->Links(); !!}
        </div>

This is my search_Location controller

public function search_location_details( Request $request )
    {


            $loc = Location_details::where(function ($query) use ($request)
                {

                    if (!empty($request->location)) {
                    $query->Where('ven_loc', 'LIKE', '%' . $request->location . '%');
                    }

                if (!empty($request->area)) {
                    $query->Where('ven_area', 'LIKE', '%' . $request->area . '%');
                }

                if (!empty($request->booth)) {
                    $query->Where('ven_booth', 'LIKE', '%' . $request->booth . '%');
                }

            })->orderBy('created_at','desc')->paginate(10);

             return view('Location_details.tbody', compact('loc'));     

         
    }

This is my ajax

success:function(data)
        {
            console.log(data);

              $('#results').html(data);
             

        },

everything works fine. but pagination is the only problem

see i have given pagination in the view file..

Kindly help me this

it sorts correctly, but when i click page 2 then the page is reloaded so once again i need to search..

When i click page 2 page is refereshed how to solve this??

AbdulBazith left a reply on Problem In Pagination After Ajax Return In Laravel • 3 days ago

@jlrdw @newbie360 @pardeepkumar

thank you guys

Let me try..

Kindly if possible refer my thread and give a solution for that

How to use form tag in ajax return in laravel?

AbdulBazith left a reply on How To Use Form Tag In Ajax Return In Laravel? • 3 days ago

@tykus

your solution 'partial' worked thank youu soo much

But i have given pagination in my search also thats not working why?

This is my controller before search


 public function index()
    {

        $loc=Location_details::orderBy('created_at','desc')->paginate(10);
        return view('Location_details.view')->withloc($loc);

    }

This is my partials 'tbody'


        @foreach($loc as $locs)
            <tr>
                <td>{{ $locs->ven_loc }}</td>
                <td>{{ $locs->ven_area }}</td>
                <td>{{ $locs->ven_booth }}</td>
<td>

        {!! Form::open(['route'=>['Location_details.destroy',$locs->id], 'onsubmit' => 'return ConfirmDelete()','method'=>'Delete']) !!}
    <a href="{{ route('Location_details.edit',$locs->id) }}" class="btn btn-info glyphicon glyphicon-edit"></a>

    <button type="submit" class="btn btn-info glyphicon glyphicon-trash">
        </button>
</td>

{!! Form::close() !!}
     </tr>
        @endforeach



This is my view

 </table>

        <div class="text-center">

            {!! $loc->Links(); !!}
        </div>

This is my search_Location controller


public function search_location_details( Request $request )
    {


            $loc = Location_details::where(function ($query) use ($request)
                {

                    if (!empty($request->location)) {
                    $query->Where('ven_loc', 'LIKE', '%' . $request->location . '%');
                    }

                if (!empty($request->area)) {
                    $query->Where('ven_area', 'LIKE', '%' . $request->area . '%');
                }

                if (!empty($request->booth)) {
                    $query->Where('ven_booth', 'LIKE', '%' . $request->booth . '%');
                }

            })->orderBy('created_at','desc')->paginate(10);

             return view('Location_details.tbody', compact('loc'));     

         
    }


This is my ajax


success:function(data)
        {
            console.log(data);

              $('#results').html(data);
             

        },


see i have given pagination in the view file..

Kindly help me this

it sorts correctly, but when i click page 2 then the page is reloaded so once again i need to search..

15th August, 2018

AbdulBazith left a reply on How To Use Form Tag In Ajax Return In Laravel? • 4 days ago

@tykus sorry somewhat busy with other work.

just now seeing your answer.

but Is it possible to redirect to index method() in controller by ajax request from view.blade

i have a made a new thread based on this. if possible kindly answer that. because if that worked, i can easily complete my project.

i have explained it detail in that thread

Kindly refer that:

Is it possible to redirect to index method() in controller by ajax request from view.blade in laravel

AbdulBazith started a new conversation Is It Possible To Redirect To Index Method() In Controller By Ajax Request From View.blade Laravel • 4 days ago

Guys I am working with a project. I have a view.blade (Location_details.view) file which displays the records in tabular format. I also have a search box in my view.blade. When I type a name in that search box, the change event runs in ajax and it moves to controller to search the name typed in the search box and returns the value.

My doubt is instead of returning the result, is it possible to redirect the same view.blade file with the searched output without reloading?

That is this is my index method in controller

public function index()
    {

        $loc=Location_details::orderBy('created_at','desc')->paginate(10);

        return view('Location_details.view')->withloc($loc);

    }

this is my ajax


$('#location,#area,#booth').on('keyup',function(){


        $.ajax({

        type : 'get',
        dataType: 'json',

        url : '{{URL::to('search_location_details')}}',

        data:{
                'location': $('#location').val(),
                'area': $('#area').val(),
                'booth': $('#booth').val()

        },

        success:function(data){

            console.log(data);

            var res='';
            $.each (data, function (key, value) {
            res +=
            '<tr>'+
                '<td>'+value.ven_loc+'</td>'+
                '<td>'+value.ven_area+'</td>'+
                '<td>'+value.ven_booth+'</td>'+
                '<td>'+ "<a href='{{ route('Location_details.edit',$locs->id) }}' class='btn btn-info' style='width: 30%; float:left; margin-right:10px; '>Edit</a>"+

                "<a href='{{ route('Location_details.destroy',$locs->id) }}' class='btn btn-info' style='width: 30%;  '>Delete</a>"
                +'</td>'+
            '</tr>';
   });

         $('tbody').html(res);

        }
        });
        })

I have a menu bar when I click view menu in the menu bar the index method in controller calls and displays the details through Location_details.view. After search through the ajax also once again the Location_details.view file must be called without reloading.

Is it possible?

this is my success part in ajax return

 success:function(data){

            console.log(data);

            var res='';
            $.each (data, function (key, value) {
            res +=
            '<tr>'+
                '<td>'+value.ven_loc+'</td>'+
                '<td>'+value.ven_area+'</td>'+
                '<td>'+value.ven_booth+'</td>'+
                '<td>'+ "<a href='{{ route('Location_details.edit',$locs->id) }}' class='btn btn-info' style='width: 30%; float:left; margin-right:10px; '>Edit</a>"+

                "<a href='{{ route('Location_details.destroy',$locs->id) }}' class='btn btn-info' style='width: 30%;  '>Delete</a>"
                +'</td>'+
            '</tr>';
   });

         $('tbody').html(res);

        }



see instead of doing the success part in the ajax is it possible to make the view file to load once again with the searched data without reloading the page.

Why i am asking this because. I done this search in ajax return. Due to ajax return output i am suffering from pagination problem, and few problems like button placing(for edit and delete) etc. If it is possible to make the Location_details.view to load once again without reload means my whole problem will be solved and my project will be completed.

i think everyone understood the question..?

Kindly some one help please

13th August, 2018

AbdulBazith left a reply on How To Return The Excel Download To Ajax ?? • 6 days ago

according to @tykus answer this worked

The data will be transformed to a query string on an AJAX GET request; just do that yourself using the jQuery param function:

$('#excel').on('click',function(){
    var query = {
        location: $('#location').val(),
        area: $('#area').val(),
        booth: $('#booth').val()
    }


    var url = "{{URL::to('downloadExcel_location_details')}}?" + $.param(query)

   window.location = url;
});

AbdulBazith left a reply on Problem In Performing Excel Conversion Through Ajax Call In Laravel • 6 days ago

according to @tykus answer this worked

The data will be transformed to a query string on an AJAX GET request; just do that yourself using the jQuery param function:

$('#excel').on('click',function(){
    var query = {
        location: $('#location').val(),
        area: $('#area').val(),
        booth: $('#booth').val()
    }


    var url = "{{URL::to('downloadExcel_location_details')}}?" + $.param(query)

   window.location = url;
});

AbdulBazith left a reply on Maatwebsite Excel Is Created But Not Downloading In Ajax Call In Laravel Why?? • 6 days ago

according to @tykus answer this worked

The data will be transformed to a query string on an AJAX GET request; just do that yourself using the jQuery param function:

$('#excel').on('click',function(){
    var query = {
        location: $('#location').val(),
        area: $('#area').val(),
        booth: $('#booth').val()
    }


    var url = "{{URL::to('downloadExcel_location_details')}}?" + $.param(query)

   window.location = url;
});

AbdulBazith left a reply on Ajax Return Is Not Downloading The Excel File Using Maatwebsite In Laravel • 6 days ago

according to @tykus answer this worked

The data will be transformed to a query string on an AJAX GET request; just do that yourself using the jQuery param function:


$('#excel').on('click',function(){
    var query = {
        location: $('#location').val(),
        area: $('#area').val(),
        booth: $('#booth').val()
    }


    var url = "{{URL::to('downloadExcel_location_details')}}?" + $.param(query)

   window.location = url;
});

AbdulBazith left a reply on How To Use Sweet Alert In Laravel? • 6 days ago

@martinbean and @MThomas thankz for your response it worked.

first i included the CDN in my layout.app

and the i added the alert message in my controller

and then i included @include('sweet::alert') this in my view.blade page which i redirected after the adding or deleting process is done..

AbdulBazith left a reply on Problem In Pagination After Ajax Return In Laravel • 6 days ago

@pardeepkumar thankz for your reply

can u slightly explain what will happen in this code??

AbdulBazith left a reply on How To Save An Image And Retrieve It In View Form In Laravel • 6 days ago

used to store the image in a folder and stored the link in the data base. it worked

Refer this link:

https://www.youtube.com/watch?v=N_i3UFw0_84&list=PLwAKR305CRO-Q90J---jXVzbOd4CDRbVx&index=53

AbdulBazith left a reply on How To Use Format('d-m-Y') In Ajax Return Laravel • 6 days ago

@according to @Snapey 's and @martinbean 's suggestion

it worked

the format is based on their suggestions..


  protected $dates = [
        'created_at',
        'updated_at',
        'date'
    ];

public function getFormattedDateAttribute()
{
    return $this->date->format('d-m-Y');
}

protected $appends = ['formatted_date'];

AbdulBazith left a reply on How To Use Format('d-m-Y') In Ajax Return Laravel • 6 days ago

@Snapey @martinbean both of you thank you soo much.

it worked

actually its my mistake..

i deleted this

 protected $dates = [
        'created_at',
        'updated_at',
        'date'
    ];

thats why it showed error .. now its OK ,, thank youu..

thank you guys.

AbdulBazith left a reply on How To Use Format('d-m-Y') In Ajax Return Laravel • 6 days ago

@martinbean

i did it but showing error


Call to a member function format() on string (View: D:\XAMPP\htdocs\Laravel\milkfarm\resources\views\Excess_milk\view.blade.php)

AbdulBazith left a reply on Problem In Pagination After Ajax Return In Laravel • 6 days ago

@tykus kindly reply for this also??

please

AbdulBazith left a reply on Ajax Return Is Not Downloading The Excel File Using Maatwebsite In Laravel • 6 days ago

@tykus thank youuu soo much, it worked

Now its downloading..

wow thankz..

but it showing a warning in the console

Resource interpreted as Document but transferred with MIME type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: "http://localhost:8000/downloadExcel_vendor_details?search_name=&search_location=tirunelveli&search_booth=".


is there any problem with this??

AbdulBazith started a new conversation How To Use Form Tag In Ajax Return In Laravel? • 6 days ago

Guys iam working with a project.

i have a view.blade file which displays all the details in tabular format.

i also have 2 search boxes in my view file which searches through ajax and return the output.

my doubt is

in my view.blade file i have column for edit and delete icons. so while viewing itself if user needs they can delete the record by clicking the delete icon and edit the data by using edit icon.

this works correctly.

but after ajax return search how i can use the edit and delete icons.

i used form tags for that process. but i dont know how to use that form tag in the ajax return.

Kindly some one help please..

this is my view.blade before search

Refer this image : https://imgur.com/vrnce1T

<thead >
          <th >Location</th>
          <th> Area</th>
          <th>Booth</th>
          <th>Action</th>

  </thead>
  <tbody>
        @foreach($loc as $locs)
            <tr>
                <td>{{ $locs->ven_loc }}</td>
                <td>{{ $locs->ven_area }}</td>
                <td>{{ $locs->ven_booth }}</td>

<td>
        {!! Form::open(['route'=>['Location_details.destroy',$locs->id], 'onsubmit' => 'return ConfirmDelete()','method'=>'Delete']) !!}
    <a href="{{ route('Location_details.edit',$locs->id) }}" class="btn btn-info glyphicon glyphicon-edit"></a>

    <button type="submit" class="btn btn-info glyphicon glyphicon-trash">
        </button>
</td>

{!! Form::close() !!}
     </tr>
        @endforeach
  </tbody>

see in the above when i click edit or delete the appropiate id is taken and it moves to the controller and finds there and it delete or edit process occurs..

this is after search the same view.blade file in ajax

See i have searched for location="Tirunelveli"

Refer this image: https://imgur.com/CitL4GD

$('#location,#area,#booth').on('keyup',function(){


        $.ajax({

        type : 'get',
        dataType: 'json',

        url : '{{URL::to('search_location_details')}}',

        data:{
                'location': $('#location').val(),
                'area': $('#area').val(),
                'booth': $('#booth').val()

        },

        success:function(data){

            console.log(data);

            var res='';
            $.each (data, function (key, value) {
            res +=
            '<tr>'+
                '<td>'+value.ven_loc+'</td>'+
                '<td>'+value.ven_area+'</td>'+
                '<td>'+value.ven_booth+'</td>'+


//in this portion i need the same form tag which i given before search.

                '<td>'+ "<a href='{{ route('Location_details.edit',$locs->id) }}' class='btn btn-info' style='width: 30%; float:left; margin-right:10px; '>Edit</a>"+
                "<a href='{{ route('Location_details.destroy',$locs->id) }}' class='btn btn-info' style='width: 30%;  '>Delete</a>"
                +'</td>'+
            '</tr>';
   });

         $('tbody').html(res);

        }
        });
        })


How to perform this

here i will paste the full coding of the view.blade page



@extends('main')

@section('title','| All Location data')

@section('content')

<div class="row">
        <div class="col-md-10">
            </div>
    <div class="col-md-2">
        <a href="{{ route('Location_details.create') }}" class="btn btn-lg btn-block btn btn-info btn-h1-spacing">Add Location</a>
 </div>
<hr>
</div><!-- end of row-->

<div class="row">
<div class="col-md-12"><br> <table id="design" class="table table-bordered"> <caption id="fo"><h2 align="center">LOCATION DETAILS PREVIEW</h2></caption>

<div  style="  border: solid 1px black;  ">
    <div  class="form-group row" style="margin-left:20px;margin-right:20px;margin-top:20px;" >

        <div class="col-sm-6 ">
                <div class="form-group row">
                    <div class="col-sm-4">
                            {{ Form::label('location','Location') }}
                            {{ Form::text('location',null,array('class'=>'form-control','id'=>'location')) }}
                            </div>
                    <div class="col-sm-4">
                            {{ Form::label('area','Area') }}
                            {{ Form::text('area',null,array('class'=>'form-control','id'=>'area')) }}
                        </div>

                    <div class="col-sm-4">
                            {{ Form::label('booth','Booth') }}
                            {{ Form::text('booth',null,array('class'=>'form-control','id'=>'booth')) }}
                        </div>
                            </div>
                    </div><br>
                    <div class="col-sm-6 ">
                            <div class="form-group row">
                                    <div >
                                            <a class="btn btn-info" id='pdf',name='pdf' style="width: 10%;float:left; margin-right:10px;"</td>PDF</a>
                                    </div>



                                    <div >
                                            <a  class="btn btn-info" id='excel',name='excel' style="width: 10%;"</td> Excel</a>

                                            {{-- {{ Form::submit('Excel',array('class'=>"btn btn-lg btn-block btn btn-info",'style'=>'width: 10%;')) }} --}}

                                            {{-- {{ Form::submit('Excel',array('class="btn btn-info", style="width: 10%;)) }} --}}
                                        </div>



                            </div>
                    </div>


            </div>



</div>

<br>
  <thead >

          <th >Location</th>
          <th> Area</th>
          <th>Booth</th>
          <th>Action</th>

  </thead>

  <tbody>
        @foreach($loc as $locs)
            <tr>
                <td>{{ $locs->ven_loc }}</td>
                <td>{{ $locs->ven_area }}</td>
                <td>{{ $locs->ven_booth }}</td>



<td>

        {!! Form::open(['route'=>['Location_details.destroy',$locs->id], 'onsubmit' => 'return ConfirmDelete()','method'=>'Delete']) !!}
    <a href="{{ route('Location_details.edit',$locs->id) }}" class="btn btn-info glyphicon glyphicon-edit"></a>

    <button type="submit" class="btn btn-info glyphicon glyphicon-trash">
        </button>


</td>





{!! Form::close() !!}
     </tr>
        @endforeach
  </tbody>
  </table>

        <div class="text-center">

            {!! $loc->Links(); !!}
        </div>



</div>

</div>




<script type="text/javascript">
   

    $('#location,#area,#booth').on('keyup',function(){


        $.ajax({

        type : 'get',
        dataType: 'json',

        url : '{{URL::to('search_location_details')}}',

        data:{
                'location': $('#location').val(),
                'area': $('#area').val(),
                'booth': $('#booth').val()

        },

        success:function(data){

            console.log(data);

            var res='';
            $.each (data, function (key, value) {
            res +=
            '<tr>'+
                '<td>'+value.ven_loc+'</td>'+
                '<td>'+value.ven_area+'</td>'+
                '<td>'+value.ven_booth+'</td>'+
                '<td>'+ "<a href='{{ route('Location_details.edit',$locs->id) }}' class='btn btn-info' style='width: 30%; float:left; margin-right:10px; '>Edit</a>"+

                "<a href='{{ route('Location_details.destroy',$locs->id) }}' class='btn btn-info' style='width: 30%;  '>Delete</a>"
                +'</td>'+
            '</tr>';
   });

         $('tbody').html(res);

        }
        });
        })




$('#pdf').on('click',function(){


$.ajax({
    type : 'get',
    url : '{{URL::to('downloadpdf_location_detail')}}',

    data:{
        'location': $('#location').val(),
                'area': $('#area').val(),
                'booth': $('#booth').val()
    },

    success:function(data)
    {

        alert("downloaded");
    }
    });

})


$('#excel').on('click',function(){


$.ajax({
    dataType: 'json',
    type : 'get',
    url : '{{URL::to('downloadExcel_location_details')}}',

    data:{
        'location': $('#location').val(),
                'area': $('#area').val(),
                'booth': $('#booth').val()
    },



    success:function(data)
    {
        alert(' downloaded');
          console.log("downloaded", data);
        // alert("downloaded");
    },
    fail: function(data) {
            alert('Not downloaded');
            console.log('fail',  data);
        }


    });


    // alert('Not downloaded');

})


    </script>

@endsection


Kindly some one help please for this

AbdulBazith left a reply on Ajax Return Is Not Downloading The Excel File Using Maatwebsite In Laravel • 6 days ago

@tykus

showing error


Uncaught TypeError: window.location is not a function

AbdulBazith left a reply on Sweet Alert Worked, But It Closes Within Seconds Why? • 6 days ago

@tykus thank you sooooo much,

it worked..

Both of your codings worked..

AbdulBazith left a reply on Ajax Return Is Not Downloading The Excel File Using Maatwebsite In Laravel • 6 days ago

@tykus thankz for the response

why i need ajax is to pass the data..

i have search box through that i will pass data specifically a name. so that on record of that name can be downloaded as excel

thats y..

kindly reply me

11th August, 2018

AbdulBazith started a new conversation Ajax Return Is Not Downloading The Excel File Using Maatwebsite In Laravel • 1 week ago

Guys iam working with a project

i used Maatwebsite to convert excel. everything is file..

the excel file is created. but it is not downloading in ajax call

why???

Kindly some one help

my controller


$ex = Location_details::get();

 Excel::create('LocationDetails', function($excel) use ($ex_array) {
                    $excel->sheet('Sheet1', function($sheet) use ($ex_array)
                    {

                        $sheet->fromArray($ex_array,null,'A1',true);
                    });
               })->download('xlsx');

           //    return response()->json();// see even though this line is there it is not downloading

        }

but see the below image in network tab it created successfully

Refer: https://imgur.com/a/fQ83g5S

if i double click it the network tab.. see the image which is highlighted with blue color. if i double click it then the excel is downloading

this is my ajax


$('#excel').on('click',function(){


$.ajax({
    dataType: 'json',
    type : 'get',
    url : '{{URL::to('downloadExcel_location_details')}}',

    data:{
        'location': $('#location').val(),
                'area': $('#area').val(),
                'booth': $('#booth').val()
    },



    success:function(data)
    {
        alert(' downloaded');
          console.log("downloaded", data);
        
    },
    fail: function(data) {
            alert('Not downloaded');
            console.log('fail',  data);
        }

    });  

})


the not downloaded message is displayed

Kindly some one help

AbdulBazith left a reply on How To Use Format('d-m-Y') In Ajax Return Laravel • 1 week ago

@snapey how i should do that review??

i used inspect, but the error pages code only displays in the inspect..

AbdulBazith left a reply on Sweet Alert Worked, But It Closes Within Seconds Why? • 1 week ago

@LearnHunter thankz for your reply.

but still it closes immediately why?

actually warning messages or error messages must stop then only user can see

but it disappears ..

Kindly help ya

AbdulBazith left a reply on How To Save An Image And Retrieve It In View Form In Laravel • 1 week ago

@LearnHunter @tykus thankz guys for your reply..

@Snapey let me try spatie media alsooo thankz ..

AbdulBazith left a reply on How To Save An Image And Retrieve It In View Form In Laravel • 1 week ago

@Snapey thankz for your suggestion

@tykus thanks for your suggestion.

it worked. but the image size is too large how to uniform the images into smaller size??

AbdulBazith started a new conversation Sweet Alert Worked, But It Closes Within Seconds Why? • 1 week ago

Guys i am working with a project, iam using sweet alert. but it closes immediately

how to solve

this is my code

i used

   <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.0.0/sweetalert.min.js"></script>

in my partials.

i used the below code in my view.blade

@include('sweet::alert')

this is my controller

 Alert::success('Data Deleted successfully');

the message is closed fast why??

AbdulBazith left a reply on How To Use Format('d-m-Y') In Ajax Return Laravel • 1 week ago

@Saikishore thankz for you response.

actually first i used as u said only. but the problem is the same thing i need to use it my javascript also.

in normal view what you said is ok, but in javascript how i can use it.

Kindly read my question once again

AbdulBazith left a reply on How To Use Format('d-m-Y') In Ajax Return Laravel • 1 week ago

@Snapey and @martinbean i tried

but it sows error

Call to a member function format() on string (View: D:\XAMPP\htdocs\Laravel\milkfarm\resources\views\Excess_milk\view.blade.php)

i used

class Excess_milk extends Model
{

    public $table= 'excess_milk';

    public function getFormattedDateAttribute()
{
    return $this->date->format('d-m-Y');
}
protected $appends = ['formatteddate'];
}

and this also

instead of

protected $appends = ['formatteddate']; i used

protected $appends = ['formatted_date']; but the same error

AbdulBazith left a reply on How To Save An Image And Retrieve It In View Form In Laravel • 1 week ago

@Snapey thank you for your response

i tried this, in my controller

 $file = $request->file('image');
$contents = $file->openFile()->fread($file->getSize());
 $vendor_details->image=$contents;

this succesfully stored in my DB..

how can i retrive it in my view.blade

i used this but not working

 <td>{{ $vens->image }}</td>

is that a right way i am doing???

AbdulBazith started a new conversation How To Save An Image And Retrieve It In View Form In Laravel • 1 week ago

Guys i am working with a project.

i am having a form which asks details about vendor name, id, address and stores in db and the i viewed it in view.blade as tabular format.

Now i need to add image of the vendor too

How can i perform this?

i referred in google and some says to store in public folder, some says can directly store in db, some says just store the path in db.

which is better.

whats my objective is to get the image from the user and store it in DB and thenin view.blade to display the details as well as the image also

this is what my controller to get the details of the vendor,

 $this->validate($request,array(
        'vendor_id'=>'required',
         'vendor_name'=>'required|unique:vendor_details,vendor_name',
        'ven_loc'=>'required',
        'rate_per_litre'=>'required',
        'ven_area'=>'required',
        'ven_booth'=>'required',
        'vendor_phno'=>'required|integer',
        'vendor_address'=>'required',
        'note'=>'required'


       ));

       //inserting values

        $vendor_details=new vendor_details;

        $vendor_details->vendor_id = trim($request->vendor_id);
        $vendor_details->vendor_name=trim($request->vendor_name);
        $vendor_details->ven_loc=trim($request->ven_loc);
        $vendor_details->ven_area=trim($request->ven_area);
        $vendor_details->ven_booth=trim($request->ven_booth);
        $vendor_details->vendor_phno=trim($request->vendor_phno);
        $vendor_details->rate_per_litre=trim($request->rate_per_litre);
        $vendor_details->vendor_address=trim($request->vendor_address);
        $vendor_details->note=trim($request->note);

       $vendor_details->save();



         Session::flash('success',' Vendor Data Entered succesfully');

       return redirect()->route('Vendor_details.create' );


in this additionally i need to insert the image also

this is what my view.blade

  $ven = Vendor_details::orderBy('created_at','desc')->paginate(5);

         return view('Vendor_details.view')->withven($ven);


Kindly some one help please

10th August, 2018

AbdulBazith left a reply on How To Use Sweet Alert In Laravel? • 1 week ago

@martinbean thankz for your reply,

Noo,, sorry.. and sorry for late response net feel well past two days.

Let me try and say what it shows..

AbdulBazith left a reply on How To Use Format('d-m-Y') In Ajax Return Laravel • 1 week ago

@Snapey thankz for your response

sorry for the delay. two days absent

i tried like this in my model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Excess_milk extends Model
{

    public $table= 'excess_milk';

    public function getFormattedDateAttribute()
{
    return $this->date->format('d-m-Y');
}

protected $appends = ['formattedDate'];
}



and in my ajax return

  $.each (data, function (key, value) {
            res +=
            '<tr>'+
                '<td>'+value.date+'</td>'+
                '<td>'+value.time+'</td>'+
                '<td>'+value.no_of_litre+'</td>'+
                '<td>'+value.note+'</td>'+
                '<td>'+ "<a href='{{ route('Excess_milk.show',$ex->id) }}'  class='btn btn-info' style='width: 40%; float:left; margin-right:5px;'>Edit</a>"+

                "<a href='{{ route('Excess_milk.show',$ex->id) }}' class='btn btn-info' style='width: 30%; '>Delete</a>"


                +'</td>'+
            '</tr>'


But nothing happening kindly sugest idea

and how to use form tag in ajax return,

this is my normal view.blade

     <td>      
        {!! Form::open(['route'=>['Excess_milk.destroy',$ex->id],'onsubmit' => 'return ConfirmDelete()','method'=>'DELETE']) !!}

        <button type="submit" class="btn btn-info glyphicon glyphicon-trash">
            </button>

        </td>

how i can write the same in ajax return

   '<td>'+  "{!! Form::open(['route'=>['Vendor_details.destroy',$vens->id], 'onsubmit' => 'return ConfirmDelete()','method'=>'Delete']) !!}<button type='submit' class='btn btn-info glyphicon glyphicon-trash' disabled></button>"
                +'</td>'+


this showing error Uncaught SyntaxError: Unexpected identifier?

kindlyy suggest for this also please..

else is there any idea for using delete after ajax return..

Kindly help for date and delete please..

7th August, 2018

AbdulBazith left a reply on How To Make A Delete Button In Laravel? • 1 week ago

@tykus

'onsubmit' => 'confirm("Are you sure?")'

if cancel also working how??

???

AbdulBazith left a reply on How To Use Sweet Alert In Laravel? • 1 week ago

@MThomas ok let me try and update you

AbdulBazith left a reply on How To Use Sweet Alert In Laravel? • 1 week ago

@MThomas

i included

@include('sweet::alert')

But nothing response

why what is the problem

i did everything i think so

else i need to do anything in my createform.blade..??

AbdulBazith left a reply on How To Make A Delete Button In Laravel? • 1 week ago

@tykus .. the confirmation

'onsubmit' => 'confirm("Are you sure?")'

shows an alert msg, asking ok or cancel..

even if i cancel it deletes the record yyyy???

AbdulBazith left a reply on How To Make A Delete Button In Laravel? • 1 week ago

@tykus .. great..

thank you.. its working fine thank you soooo much

kindly refer my other post (questions) and if possible please answer for that please ya..

Kindly help mee

AbdulBazith left a reply on How To Use Sweet Alert In Laravel? • 1 week ago

@MThomas

One doubt,

actually, iam having a from create.blade which has to fill the details and if i click save it comes to the controller store() method and stores everything, and then these two lines must execute

  Alert::message('Location data entered succesfully!');

            return redirect()->route('Location_details.create');


so whats my doubt is where should i include

@include('sweet::alert')

and where should i add this

<script src="js/sweetalert.min.js"></script>

iam using CDN. so is there any need to install JS library for sweet alert???

AbdulBazith left a reply on How To Return More Than One Variable To Ajax From Controller • 1 week ago

@Artak

thankz for you suggestion.. i understood. but where i can add action listener.


<script type="text/javascript">
 $('#search_fromdate,#search_todate,#search_time').on('change',function(){

        $.ajax({
        dataType: 'json',
        type : 'get',
        url : '{{URL::to('search_excess_milk_details')}}',

        data:{ 'search_fromdate': $('#search_fromdate').val(),
                'search_todate': $('#search_todate').val(),
                'search_time': $('#search_time').val(),

        },

        success:function(data)
        {

            var res='';
            $.each (data, function (key, value) {
            res +=
            '<tr>'+
                '<td>'+value.date+'</td>'+
                '<td>'+value.time+'</td>'+
                '<td>'+value.no_of_litre+'</td>'+
                '<td>'+value.note+'</td>'+
                '<td>'+ "<a href='{{ route('Excess_milk.show',$ex->id) }}'  class='btn btn-info' style='width: 40%; float:left; margin-right:5px;'>Edit</a>"+

                "<a href='{{ route('Excess_milk.show',$ex->id) }}' class='btn btn-info' style='width: 30%; '>Delete</a>"


                +'</td>'+
            '</tr>';

   });
            $('tbody').html(res);
        }


    });
    })

this is my javascript in textbox change event

and this is my controller

$xcess_milks = Excess_milk::where(function ($query) use ($request)
                       {

                        if (!empty($request->search_fromdate) && !empty($request->search_todate) ) {

                            $query->whereBetween('date', [$request->search_fromdate, $request->search_todate]);
                          }                

                    })->orderBy('date','asc')->take(2)->get();


                    return $xcess_milks;

now what should i do?? kindly help..

AbdulBazith left a reply on How To Make A Delete Button In Laravel? • 1 week ago

@tykus thankz for your response

it is working. is this the correct procedure for delete??

else is there any other idea?

and another thing

 {{ Form::submit('Delete',array( 'class'=>'btn glyphicon glyphicon-trash' )) }}

the class trash not working why??

but

class'=>'btn btn-info btn-sm' // this works correctly

i need the trash bootstrap icon in my delete..

and this is my edit this works correctly

 <a href="{{ route('Vendor_details.edit',$vens->id) }}" class="btn btn-info glyphicon glyphicon-edit", style=" float:left; margin-right:10px;"></a>

why??

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.