ajax

call javascript function outside foreach loop

强颜欢笑 提交于 2021-01-29 05:00:20
问题 I have a problem with my JavaScript function, when I put my script inside foreach loop like code I have below everything work fine, but I think it should be outside, so anyone can give me the advide to resolve this, I appreciate it @foreach($messages->reverse() as $message ) <ul class="id{{$message->id}}" data-id="{{$message->id}}"> <li class="message"> <div class="text {{ ($message->to!=Auth::user()->id)?'not_owner':'owner'}}"> {{$message->text}} </div><br> </li> <li class="message"> <div

JQuery wait for x sec. of inactivity before calling function

六月ゝ 毕业季﹏ 提交于 2021-01-29 04:49:05
问题 I have a form with multiple buttons, sliders, etc. that all trigger a main ajax pricing function when clicked, dragged, etc. Often a button is clicked multiple times consecutively in a short amount of time (e.g. a + button to increase a value). Instead of calling the main ajax function each time, I would like JQuery to wait for 1 sec after the LAST trigger event is done before executing. In other words, if the function is triggered < 1s since the last trigger... wait. 回答1: I would do a

Jquery ui autocomplete on multiple input fields with ajax results

天涯浪子 提交于 2021-01-29 04:46:54
问题 I am trying to do what several other people have accomplished here on stack. I have tried all of the examples available and cannot seem to get this to work. I've copied working examples and reflected changes to match my case and still, nada. HTML I am using looks like this. <tr> <td><a id="remRow"><span class="icon icon-squared-cross"></span></a></td> <td><input type="hidden" data-type="itemID" name="itemID[]" id="itemID" class="form-control autocomplete_txt" autocomplete="off"> <input type=

Retrieve ajax/JavaScript return results from webpage in c#

两盒软妹~` 提交于 2021-01-29 04:40:35
问题 I’m trying to retrieve the content of a webpage in c#. The problem is that the webpage uses Ajax and JavaScript to dynamically create and populate the HTML elements. The webpage I’m talking about is: http://diseases.jensenlab.org/Entity?order=textmining,knowledge,experiments&textmining=10&knowledge=10&experiments=10&type1=9606&type2=-26&id1=ENSP00000317985 If you use httpWebRequest to get the HTML code of the website, only the JavaScript calls are visible and not the content. So how can you

Access “data” object in AJAX request inside success function

☆樱花仙子☆ 提交于 2021-01-29 04:02:54
问题 How can I access the data object used in a $.ajax() request? $.ajax({ url: "post.php", type:'POST', data:{ el1: $('#el1').val(), ... el72: $('#el72').val() }, success: function(res,status){ // } }); 回答1: You can access the processed options that you passed into $.ajax from within the success callback using this , as long as you didn't bind the function, use an arrow function, or use the context option. console.log(this.data); // for POST console.log(this.url); // for GET, but you'll have to

Showing the count of my user and display it on badge. (Codeigniter)

心不动则不痛 提交于 2021-01-29 04:00:01
问题 Newbie here. I did an ajax to count the users and display it on my badge, however, whenever I'm clicking on 1 button (Modal with table), it is displaying on all badges. For example. I have 4 users in my first row modal table. The #4 count is displayed to all of my badges. Which is something that is weird. My target is to display the count in my badge dynamically. I have provided a video and images below for better explanation. https://streamable.com/z6dqgi << This is the output of what I made

Javascript loop with ajax call

谁说胖子不能爱 提交于 2021-01-29 03:52:10
问题 I've been struggling all afternoon to understand how to make this work, hopefully someone can help. I have a simple requirement to run through a list of checked check boxes, retrieve some data from the server, fill an element with the data expand it. So far I have the following code; function opentickedrows() { $('input[type=checkbox]').each(function () { if (this.checked) { tid = $(this).attr('name').replace("t_", ""); $.ajax({ url: '/transfer_list_details_pull.php?id=' + tid, type: 'GET',

Refresh page after delete photo

人走茶凉 提交于 2021-01-29 03:26:25
问题 Hi I have function in javascript where I delete photos from database and from server. It work fine, I delete photo but this photo is still in my browser. I have question. How can I refresh only on javascript side? container.addEventListener("click", function(e){ if(e.target.tagName == 'BUTTON'){ var id = e.target.dataset.type; var r = confirm("Are You sure to delete?"); if (r == true) { $.ajax({ type: 'POST', url: 'index.php?r=gallery/deletep&name='+id, dataType: 'html' }); } } }); Now I

Refresh page after delete photo

不想你离开。 提交于 2021-01-29 03:25:04
问题 Hi I have function in javascript where I delete photos from database and from server. It work fine, I delete photo but this photo is still in my browser. I have question. How can I refresh only on javascript side? container.addEventListener("click", function(e){ if(e.target.tagName == 'BUTTON'){ var id = e.target.dataset.type; var r = confirm("Are You sure to delete?"); if (r == true) { $.ajax({ type: 'POST', url: 'index.php?r=gallery/deletep&name='+id, dataType: 'html' }); } } }); Now I

Angular2 and Laravel CSRF protection

ⅰ亾dé卋堺 提交于 2021-01-29 03:14:36
问题 I have already read some topics And the problem I encountered is lies in this piece of code <meta property="csrf-token" name="csrf-token" content="{{ csrf_token() }}"> I'm using Angular2 as core engine, which sending AJAX requests to Laravel API and I'm not using blade templates - just .html files , so I can't call php function csrf_token() from html file So, I added a temporary solution by extending my /var/www/pandacrm/app/Http/Middleware/VerifyCsrfToken.php file public function handle(