Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7157911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T12:58:19+00:00 2026-05-28T12:58:19+00:00

how do i call an array from a php file to a .js file?

  • 0

how do i call an array from a php file to a .js file?

so far i have this in my functions.php.

function background(){

  global $post;
  $bgsrc = get_post_meta($post->ID, 'background', true);
   if($bgsrc != null){
    $bgsrc = explode("\n", $bgsrc);
    $ctr=0;
    foreach($bgsrc as $value){ ?> 
     <input type="hidden" value="<?php echo $value; ?>" class="bgimgsrc" id="bgimgsrc-<?php echo $ctr++; ?>" >
    <?php }
   }
 }

on my .js file i have this but its not working..

function backgroundsizer(){
 var ctr= {image:jQuery('.bgimgsrc').val()}

 jQuery.supersized({
  // Functionality
  slide_interval          :   10000,  // Length between transitions
  transition              :   1,    // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
  transition_speed  : 900,  // Speed of transition

  // Components       
  slide_links    : 'blank', // Individual links for each slide (Options: false, 'num', 'name', 'blank')
  slides      :   ctr

 });
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T12:58:19+00:00Added an answer on May 28, 2026 at 12:58 pm

    Try:

    
    function backgroundsizer(){
      var valArr = new Array();
      jQuery(".bgimgsrc").each(function() {
        valArr.push(jQuery(this).val());
      });
      //you will have values in "valArr" array, you can manipulate it, like
      var joinedVals = valArr.join(","); // just an example
    
    

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can a function inside the functions.php file call another function from within functions.php? I'm
From: http://ejohn.org/apps/learn/#2 Function.prototype.bind = function(){ var fn = this, args = Array.prototype.slice.call(arguments), object =
I have a function in a functions.php file that defines certain variables: add_action( 'the_post',
I have created a function within my themes functions.php file in order to persist
I have an ajax call to a php file that encodes the array into
Does python have a function like call_user_func() in PHP? PHP Version: call_user_func(array($object,$methodName),$parameters) How do
I am using an Ajax call to a PHP file to get data from
I have a PHP file using json_encode to make a single call, but it
Initially, I used a .js file that contains AJAX functions to call a .php
Hi i have written a function in .php file. i.e. public static function getCategories($id_lang

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.