JavaScript Get an specific value in <a> html with javascript-ajax Django

I'm using Django and Python 3.

I have this in my HTML code:

{% for category in categories() %}
    <li class="c-menu__item fs-xsmall">
        <a target='_blank' href="#" id="next-category">
            {{ category}}
        </a>
    </li>
    <input type="hidden" value="{{ category.code }}" id="category-id">
{% endfor %}
<div class="col-xs-4" id="sub_categories">
</div>

That lists few categories.

And I have this in my script:

$( document ).on( 'click', '#next-category', function(e){
    e.preventDefault();
    $.ajax({
        url : 'product_category/addAjax',
        type : 'POST',
        data : {
            category: $( '#category-id').val(),
        },
    })
    .fail(function( jqXHR, textStatus, errorThrown ){
        console.log('FAIL');
    })
    .done(function(data){
        console.log('DONE');
        $('#sub_categories').prop('innerHTML',data["sub_categories"]);

    });
    return false;
});

When I print: $( '#category-id').val(), I always get the same value. It doesn't matter if I choose the first category listed or the last one, I will always get the same value. I have no idea what's wrong.

Answer:1

I'm trying to use the panResonder in my React Native app. I tried doing so using class properties instead of constructor and super(). Here is the code: export default class Deck extends Component { ...

I'm trying to use the panResonder in my React Native app. I tried doing so using class properties instead of constructor and super(). Here is the code: export default class Deck extends Component { ...

  1. es6 react native
  2. es6 syntax react native
  3. es6-promise react-native
  4. es6 features in react native
  5. react native es6 support
  6. react native es6 tutorial
  7. react native es6 function
  8. react native es6 classes
  9. react native es6 modules
  10. react-native es6-symbol
  11. es6 trong react native

I want to customize the search displayed by Global Search Box in Dynamics Crm by applying some custom Javascript to it. Is there any way to achieve it

I want to customize the search displayed by Global Search Box in Dynamics Crm by applying some custom Javascript to it. Is there any way to achieve it

  1. customize global search salesforce
  2. customize global search salesforce lightning
  3. customize global search
  4. custom global search lightning component
  5. salesforce customize global search results
  6. servicenow customize global search
  7. custom object global search
  8. can we customize global search in salesforce
  9. dynamics 365 customize global search
  10. how do i customize global search in salesforce
  11. customize global search in salesforce

Can you please advise how can I initiate .click [or alternative] on "PressHERE" button on IE website [VBA]? I have tried calling it by classname, tagname and even Id which is not stated in the ...

Can you please advise how can I initiate .click [or alternative] on "PressHERE" button on IE website [VBA]? I have tried calling it by classname, tagname and even Id which is not stated in the ...

I want to create an uploader with js. Can anyone help me how to upload a file using javascript?

I want to create an uploader with js. Can anyone help me how to upload a file using javascript?

  1. upload file using curl
  2. upload file using json
  3. upload file using postman
  4. upload file using selenium
  5. upload file using putty
  6. upload file using javascript
  7. upload file using ajax
  8. upload file using ssh
  9. upload file using jquery
  10. upload file using reactjs
  11. upload file using rest api
  12. upload file using scp
  13. upload file using node js
  14. upload file using aws cli s3
  15. upload file using fetch
  16. upload file using sftp
  17. upload file using terminal
  18. upload file using powershell
  19. upload file using ftp
  20. upload file using php