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

167
Views
Necesita ayuda para que javascript solo se ejecute una vez por usuario cuando haga clic en el botón

Dónde y qué debo agregar a este script o botón para que solo se ejecute una vez por usuario. Actualmente, cada vez que se actualiza la página, se agrega un nuevo registro duplicado a la lista de puntos compartidos.

 Here is a sample of the javascript code - what and where do I add lines in to make it only run once per user and not duplicate every time the page is refreshed <script type="text/javascript"> $(document).ready(function() { ExecuteOrDelayUntilScriptLoaded(AddListItem, "sp.js"); }); function AddListItem(){ var ListName = "MyList"; var context = new SP.ClientContext.get_current(); // the current context is taken by default here //you can also create a particular site context as follows //var context = new SP.ClientContext('/Sites/site1'); var lstObject = context.get_web().get_lists().getByTitle(ListName); var listItemCreationInfo = new SP.ListItemCreationInformation(); var newItem = lstObject.addItem(listItemCreationInfo); newItem.set_item('Title', 'This is new item'); // set values to other columns of the list here newItem.update(); context.executeQueryAsync(Function.createDelegate(this, this.onSuccess), Function.createDelegate(this, this.onFailure)); function onSuccess() { alert('Item created: ' + newItem.get_id()); } function onFailure(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); } } </script> <html> <body> <input type="button" value="submit" id="btnSub" onclick="AddListItem();" /> </html> </body>

Funciona y publica datos en mylist; sin embargo, cada vez que se actualiza la página, se agrega otro registro.

about 4 years ago · Juan Pablo Isaza
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!