Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shafiqkr's avatar

Jquery- issue to load html via ajax

I have layout file which has all css and js files

 layouts/app.blade.php

Now I am loading html to a div inside app.blade.php via ajax jquery

$.ajax({
    method: 'POST',
    type : 'POST',
    url  : main_path+'/getListingsData',
    beforeSend: function(){
    $(".se-pre-con").fadeIn("slow");
    },
    data: frmData,
    success :  function(data)
    {
        $("#map_load").fadeIn(1000).show(function()
            {
             $('#loadlst_data').empty();
    $('#loadlst_data').html(data['map_data']);

IN controller:

   public function getListingsData(Request $request)
  {
    $hs_list = $this->listings_list->getListingsData($request);
   $returnHTML = view('properties.mapcontents')->with('propertiesList', $hs_list)->render();
   return response()->json(array('success' => true, 'map_data'=>$returnHTML));
 }

Now all the jquery functions i have used in view "properties.mapcontents" give me error when i refresh/reload content.

Question:

1- Do i need to load all js and css files in layouts/app view only or i need to load in both

layouts/app.blade.php
properties/mapcontents.blade.php

If i include in both files then it also give error

0 likes
0 replies

Please or to participate in this conversation.