0

Let me tell you what am I trying:

I set a global object of user id to pass it into addpipe plugin JavaScript.

<script type='text/javascript'>
/* <![CDATA[ */
var providerId = {'pass_id':'<?php echo $providerInfo->wp_user_id; // provider id value is 5 ?>'};
/* ]]> */
</script>

Now I trying to get it in plugin JavaScript like so:

<script type='text/javascript'>

alert(providerId.pass_id);
var size = {    
    width: 640,        
    height: 510    
};

var flashvars = {    
    qualityurl: 'avq/480p.xml',    
    accountHash: 'xxxxxxxxxxxxxxxxxxx',    
    showMenu: 'true',    
    lang: 'translations/en.xml',    
    mrt: 20,    
    payload: 'xxxxxxxxxxxxxxxxxxx,588,5, providerId.pass_id'    
};

The providerId.pass_id is giving correct value 5 in alert popup but in the payload it is going null. I am getting payload in PHP like this:

$payload = explode(',', $json->data->payload);    
$accountHash = filter_var($payload[0], FILTER_SANITIZE_STRING);    
$userId = filter_var($payload[1], FILTER_SANITIZE_NUMBER_INT);    
$postId = filter_var($payload[2], FILTER_SANITIZE_NUMBER_INT);    
$providerId = filter_var($payload[3], FILTER_SANITIZE_NUMBER_INT);

If I set static value instead of this then everything is fine and it is also giving correct value in alert.

So please help me why providerId.pass_id is null when I am passing it in plugin JavaScript object. Let me know if I miss something.

0

1 Answer 1

1

Just concatenate the providerId.pass_id with the string in the payload part of the flashvars object like below. Currently you are just setting payload to the string 'xxxxxxxxxxxxxxxxxxx,588,5,providerId.pass_id', Where providerId.pass_id is literally a string and not a reference to the object value that you're after.

var flashvars = {
  qualityurl: 'avq/480p.xml',
  accountHash: 'xxxxxxxxxxxxxxxxxxx',
  showMenu: 'true',
  lang: 'translations/en.xml',
  mrt: 20,
  payload: 'xxxxxxxxxxxxxxxxxxx,588,5,'+providerId.pass_id
};
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.