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?

4
  • Yes, it's possible, one way or another. Commented Jun 30, 2019 at 9:55
  • I don’t think so because you’re not turning it into html or parsing the JavaScript. Commented Jun 30, 2019 at 9:55
  • How can I pass this variable? I've found a way with passing an URL as variable, giving this on script Id.... Commented Jun 30, 2019 at 10:33
  • Like this stackoverflow.com/q/40198577/2069177 but has no result... Commented Jun 30, 2019 at 10:36

1 Answer 1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.