0

I have this jquery :

var btn_ongkir_result = $('#ongkir-result').attr('href');
//-- this produce : http://example.com?dest=2313

var current_dest = btn_ongkir_result.param('dest');
//-- I'm expecting 2313 here. but it gives me error on console
//-- btn_ongkir_result.param is not a function

how to get dest parameter from btn_ongkir_result variable? thank you

2
  • 1
    If the dest parameter is the only one expected, how about splitting the URL : var url_parts = btn_ongkir_result.split('dest='); ? Then, refer to the resulting array, at index 1, this should have isolated the parameter value. I hope this helps ! Commented May 7, 2017 at 9:23
  • Also the jQuery param() is not doing what you think it does Commented May 7, 2017 at 9:25

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.