0

I have the following code:

<div class='trick' id='1234'>
  &lt;script src=&quot;/feeds/posts/default?max-results=50&amp;orderby=published&amp;alt=json-in-script&amp;callback=maps_location&quot;&gt;&lt;/script&gt;
</div>

and i'm trying to replace this with:

<div class='trick' id='1234'>
      &lt;script src=&quot;/feeds/posts/default/-/variableB?max-results=50&amp;orderby=published&amp;alt=json-in-script&amp;callback=maps_location&quot;&gt;&lt;/script&gt;
    </div>

where i want variableB equals with last_segment variable

<script type='text/javascript'>
var segment_str = window.location.pathname;
var segment_array = segment_str.split( &#39;/&#39; );
var last_segment = segment_array.pop();
</script>

So, that i'm trying to do is in a current url like http://XXXXXXX.blogspot.com/search/label/test

to have a callback feed only for label "test"

Is it possible?

1 Answers1

0

I found a solution....It's working perfectly...

<div class='trick' id='1234'>
<script>
var segment_str = window.location.pathname; // return segment1/segment2/segment3/segment4
var segment_array = segment_str.split( &#39;/&#39; );
var last_segment = segment_array.pop();

                              document.write(&quot;&lt;div id=\&quot;12345\&quot;&gt;&lt;script src=\&quot;https:\/\/tinosemagazine-new.blogspot.com/feeds/posts/default/-/&quot;+last_segment+&quot;?max-results=100&amp;orderby=published&amp;alt=json-in-script&amp;callback=maps_location\&quot;&gt;&lt;\/script&gt;&lt;\/div&gt;&quot;);
                            </script>
</div>