Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
Is good practice for use data params to keep json data instead of ajax call?

I used to keep my component data inside element's data param.

Is this good or i should use ajax call to retrieve data.

1. By data param:

 <a href="#" data-core="{JSON-data}" id="item-1">
 <a href="#" data-core="{JSON-data}" id="item-2">
 <a href="#" data-core="{JSON-data}" id="item-3">
 <a href="#" data-core="{JSON-data}" id="item-4">

Here, all data's are STATIC.

2. By Ajax:

 <a href="#" id="item-1">
 <a href="#" id="item-2">
 <a href="#" id="item-3">
 <a href="#" id="item-4">

jQuery: (Just example)

  $('#item-^').on('click', function()){
      // Action to Get data.
  });

Which one is good ?

[ Also here "JSON-data", might be in big in data size. ]

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The answer depends on the situation you are.

You can go for data param:

  • If all the data is not depend on the input from the user ie in simple words static
  • if you want to reduce multiple request to server.
  • It increase the responsiveness means you can deliver the content without a wait for data to load

You can go for ajax:

  • If data require some inputs or interactions from the user that is dynamic in nature.

  • If you want to load page faster ie, you can load page without loading all data initially

  • You can dynamically change the behavior or visual appearance if you prefer using ajax .
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!