Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves javascript structure #39

Merged
merged 3 commits into from
Jun 6, 2017
Merged

Improves javascript structure #39

merged 3 commits into from
Jun 6, 2017

Conversation

captn3m0
Copy link
Contributor

@captn3m0 captn3m0 commented Jun 5, 2017

  • Uses wp_enqueue_script and wp_localize_script

script.js Outdated
document.razorpayform.submit();
};

console.log(data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captn3m0 Is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove, my bad

<script>
var data = $json;
</script>
wp_enqueue_script('razorpay_wc_script', plugin_dir_url(__FILE__) . 'script.js',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this from gf plugin, I think. will check and fix

'https://checkout.razorpay.com/v1/checkout.js',
null, null);

wp_enqueue_script('razorpay_wc_script');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captn3m0 Why enqueue the script twice?

$data
);

wp_register_script('razorpay_checkout',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we register this script before razorpay_wc_script in order for the steps to be in the right logical order, even though they don't necessarily have to be in that order for it to work?

<form name='razorpayform' action="$redirectUrl" method="POST">
<input type="hidden" name="razorpay_payment_id" id="razorpay_payment_id">
<input type="hidden" name="razorpay_signature" id="razorpay_signature" >
<!-- This distinguishes all our various wordpress plugins -->
<input type="hidden" name="razorpay_wc_form_submit" value="1">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

Copy link
Contributor

@mayankamencherla mayankamencherla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captn3m0 Let us close this asap.

Nemo added 2 commits June 6, 2017 13:53
@captn3m0 captn3m0 merged commit 0b27ce1 into master Jun 6, 2017
@captn3m0 captn3m0 deleted the improve-js branch June 6, 2017 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants