jQuery Plugins » AJAX https://jqueryplugins.info jQuery plugins, tutorials and resources Tue, 18 Oct 2011 08:13:27 +0000 en hourly 1 http://wordpress.org/?v=3.2.1 Asynchronous Ajax Request (Form Population) jQuery (onClick works, onReady doesn’t) https://jqueryplugins.info/2011/10/asynchronous-ajax-request-form-population-jquery-onclick-works-onready-doesnt/ https://jqueryplugins.info/2011/10/asynchronous-ajax-request-form-population-jquery-onclick-works-onready-doesnt/#comments Sat, 15 Oct 2011 21:13:27 +0000 Admin https://jqueryplugins.info/2011/10/asynchronous-ajax-request-form-population-jquery-onclick-works-onready-doesnt/ Post link: Asynchronous Ajax Request (Form Population) jQuery (onClick works, onReady doesn’t)

I have the following function which works fine when tied to an onClick() event.. However if the event is fired onReady() it fails to do it job.. Adding an alert()...

]]>
Post link: Asynchronous Ajax Request (Form Population) jQuery (onClick works, onReady doesn’t)

I have the following function which works fine when tied to an onClick() event.. However if the event is fired onReady() it fails to do it job.. Adding an alert() at any point in the method allows it to work fine.. So I know it’s related to an Asynchronous AJAX request. I just haven’t had any luck successfully adding deferred or callback logic.. not sure how to approach it.

Does a simple way exist to improve the method? I’m ultimately calling this method onOpen() for a jQueryUI Dialog.. But the dialog fires and is empty..

function performElqLookups(formName) {
    var elqTracker = new jQuery.elq(459);
    //first do the visitor lookup
    var visitorLookup = 'ba109a0a75294aed95ca72b0bc3b345d';
    elqTracker.getData({ key: visitorLookup, lookup: "", success: function() {
        //then check for an email address on the visitor record and do a contact data lookup if there is one
        if (typeof GetElqContentPersonalizationValue == "function") {
            var email = GetElqContentPersonalizationValue("V_ElqEmailAddress");
                if (email != "") {
                    var contactLookup = 'c7e9dd7150464162af6fe1cf471627e5';
                    elqTracker.getData({ key: contactLookup, lookup: "<C_EmailAddress>" + email + "</C_EmailAddress>", success: function() {
                        populateForm(formName);
                        trackPage().done(function( guid ) {
                            $  ('#elqCustomerGUID').val(guid);
                        });
                    }});
                }
        }
    }});
}

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/asynchronous-ajax-request-form-population-jquery-onclick-works-onready-doesnt/feed/ 0
jQuery Ajax Request do not get successfull https://jqueryplugins.info/2011/10/jquery-ajax-request-do-not-get-successfull/ https://jqueryplugins.info/2011/10/jquery-ajax-request-do-not-get-successfull/#comments Sat, 15 Oct 2011 07:13:51 +0000 Admin https://jqueryplugins.info/2011/10/jquery-ajax-request-do-not-get-successfull/ Post link: jQuery Ajax Request do not get successfull

I have set up a form for video uploading function for 4 sites.Vimeo,Dailymotion,YouTube and viddler.I have used jQuery Ajax Submit for this. My problem is that it works fine on...

]]>
Post link: jQuery Ajax Request do not get successfull

I have set up a form for video uploading function for 4 sites.Vimeo,Dailymotion,YouTube and viddler.I have used jQuery Ajax Submit for this.
My problem is that it works fine on my server.But it appears to be choked on the live.
When i see the requests made in NET panel of firefox,they just dont show any thing for a long time only a spinning loader image.But sometimes it works fine.
Dont know why this happens.Is there something wrong on the server or what?
The server URL is http://www.videoproduction-pro.com/video/

Does any one have an idea for this behavior of the application?

Regards
Himanshu Sharma

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/jquery-ajax-request-do-not-get-successfull/feed/ 0
Ajax not processing JSON response https://jqueryplugins.info/2011/10/ajax-not-processing-json-response/ https://jqueryplugins.info/2011/10/ajax-not-processing-json-response/#comments Sat, 15 Oct 2011 04:14:41 +0000 Admin https://jqueryplugins.info/2011/10/ajax-not-processing-json-response/ Post link: Ajax not processing JSON response

In my app, a user can accept or decline a friend request. If you accept the request, my controller returns this JSON: {"icon":"<i class=\"friend_icon\" title=\"You're friends!\"><\/i>","response":"accept"} If you decline, this...

]]>
Post link: Ajax not processing JSON response

In my app, a user can accept or decline a friend request.

If you accept the request, my controller returns this JSON:

{"icon":"<i class=\"friend_icon\" title=\"You're friends!\"><\/i>","response":"accept"}

If you decline, this is the JSON response:

{"icon":"<i class=\"remove_icon\" title=\"Request declined\"><\/i>","response":"decline"}

My Ajax code:

$  ('.accept_decline a').live('click', function(event){
    event.preventDefault();

    var link = $  (this).attr('href');
    var last_seg = link.substr(link.lastIndexOf('/') + 1); //grab segment 4 of link

    $  .ajax({
        url: link,
        dataType: 'json',
        success: function(data) {

            if (data.response === 'accept') {

                $  ('#accept_' + last_seg).html(data.icon);
                $  ('#decline_' + last_seg).remove();
                $  ('.accept_decline').css('width', '35px');

            } else if (data.response === 'decline') {

                $  ('#accept_' + last_seg).remove();
                $  ('#decline_' + last_seg).html(data.icon);
                $  ('.accept_decline').css('width', '35px');
            }
        }
    });
});

HTML

        <td class="search_table_right_col accept_decline" style="width:50px">

            <a href="<?php echo base_url() . 'social/friends/accept/' . $  data->user_id . '/' . $  friends_id; ?>" id="accept_<?php echo $  friends_id; ?>">

                <i class="not_friend_icon" title="Accept request"></i>
            </a>

            <a href="<?php echo base_url() . 'social/friends/decline/' . $  data->user_id . '/' . $  friends_id; ?>" id="decline_<?php echo $  friends_id; ?>">
                <i class="remove_icon" title="Decline request"></i>
            </a>
        </td>

My problem:

When I accept a friend request, everything works fine (ie, all lines of the if... accept run).

But if I decline a request, nothing happens. No error on console. For both situations, the console shows exactly the JSON response strings above. It’s just that decline has no effect.

Placing a console.log or alert within the else if... decline also does not render anything.

What am I doing wrong?

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/ajax-not-processing-json-response/feed/ 0
jquery bind functions and triggers after ajax call https://jqueryplugins.info/2011/10/jquery-bind-functions-and-triggers-after-ajax-call/ https://jqueryplugins.info/2011/10/jquery-bind-functions-and-triggers-after-ajax-call/#comments Fri, 14 Oct 2011 08:15:24 +0000 Admin https://jqueryplugins.info/2011/10/jquery-bind-functions-and-triggers-after-ajax-call/ Post link: jquery bind functions and triggers after ajax call

function bindALLFunctions() { ..all triggers functions related go here }; $ .ajax({ type: 'POST', url: myURL, data: { thisParamIdNo: thisIdNo }, success: function(data){ $ (".incContainer").html(data); bindALLFunctions(); }, dataType: 'html' });...

]]>
Post link: jquery bind functions and triggers after ajax call

function bindALLFunctions() {
  ..all triggers functions related go here
};

$  .ajax({
        type: 'POST',
        url: myURL,
        data: { thisParamIdNo: thisIdNo },
        success:    function(data){
                        $  (".incContainer").html(data);
                        bindALLFunctions();
        },
        dataType: 'html'
});

I am new to ajax and JQuery.
I have the above ajax call in my js-jquery code. bindALLFunctions(); is used to re-call all the triggers and functions after the ajax call. It works all fine and good as expected. However, I have read somewhere that is better to load something after the initial action is finished, so I have tried to add/edit the following two without any success.
Any ideas?

1) ->    $  (".incContainer").html(data, function(){
                                          bindALLFunctions();
                                        });

2) ->    $  (".incContainer").html(data).bindALLFunctions();

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/jquery-bind-functions-and-triggers-after-ajax-call/feed/ 0
Jquery with Ajax post not working https://jqueryplugins.info/2011/10/jquery-with-ajax-post-not-working/ https://jqueryplugins.info/2011/10/jquery-with-ajax-post-not-working/#comments Wed, 12 Oct 2011 20:16:20 +0000 Admin https://jqueryplugins.info/2011/10/jquery-with-ajax-post-not-working/ Post link: Jquery with Ajax post not working

I am trying to make a simple game and i’m not very good with jquery. The code i have is: <script type="text/javascript"> $ (document).ready(function(){ $ ('#deposit').click(function(){ $ .ajax({ type: 'POST',...

]]>
Post link: Jquery with Ajax post not working

I am trying to make a simple game and i’m not very good with jquery. The code i have is:

<script type="text/javascript">
  $  (document).ready(function(){
   $  ('#deposit').click(function(){
    $  .ajax({
        type: 'POST',
        url: 'update.php',
        dataType: 'json',
        data: {
            Money : $  ('#input_money').val()
        },
        success: function(data){
        $  ('#display').html(data.value);
        }
        });
   });
});

And the display is this:

<input id="input_money" name="input_money" type="text" size="40"><br><br>
<button id="deposit">Deposit Money</button>
<div id="display"></div>

For the back end, I am using this:

if(isset($  _POST['Money'])){
$  value = $  _POST['Money'];
}else{
$  value = "";
}
echo json_encode(array("value"=>$  value));

Can anyone help me out? I plan to add the $ value into a database after it shows up on the main page.

Thanks

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/jquery-with-ajax-post-not-working/feed/ 0
Protect the execution of my php script called from ajax https://jqueryplugins.info/2011/10/protect-the-execution-of-my-php-script-called-from-ajax/ https://jqueryplugins.info/2011/10/protect-the-execution-of-my-php-script-called-from-ajax/#comments Wed, 12 Oct 2011 10:14:50 +0000 Admin https://jqueryplugins.info/2011/10/protect-the-execution-of-my-php-script-called-from-ajax/ Post link: Protect the execution of my php script called from ajax

im making a ajax call from jquery to a php script located in my own server like: $ .ajax({ url: 'ajax.php', .... Its any way to protect the execution of...

]]>
Post link: Protect the execution of my php script called from ajax

im making a ajax call from jquery to a php script located in my own server like: $ .ajax({ url: 'ajax.php', ....

Its any way to protect the execution of this file directly? I mean, some IF statement that only let the code begin if the file ajax.php is called from lets say an jquery script writen in origin.html and NOT if the file is called directly?

Thanks for any help!

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/protect-the-execution-of-my-php-script-called-from-ajax/feed/ 0
Cross-subdomain ajax request with jquery always results in jsonp, even when document.domain is set correctly https://jqueryplugins.info/2011/10/cross-subdomain-ajax-request-with-jquery-always-results-in-jsonp-even-when-document-domain-is-set-correctly/ https://jqueryplugins.info/2011/10/cross-subdomain-ajax-request-with-jquery-always-results-in-jsonp-even-when-document-domain-is-set-correctly/#comments Wed, 12 Oct 2011 06:15:48 +0000 Admin https://jqueryplugins.info/2011/10/cross-subdomain-ajax-request-with-jquery-always-results-in-jsonp-even-when-document-domain-is-set-correctly/ Post link: Cross-subdomain ajax request with jquery always results in jsonp, even when document.domain is set correctly

In my application I have a website on one sub-domain (dev.u413.com) and I use jquery to make an ajax request to a JSON api on another sub-domain (api.u413.com). When I...

]]>
Post link: Cross-subdomain ajax request with jquery always results in jsonp, even when document.domain is set correctly

In my application I have a website on one sub-domain (dev.u413.com) and I use jquery to make an ajax request to a JSON api on another sub-domain (api.u413.com). When I inspect the requests in Chrome dev tools and Firefox Firebug it appears as though the requests are acting like jsonp. They do not appear in the XHR section with normal ajax requests. I did not specify jsonp and I set document.domain to a suffix of the current domain: document.domain = 'u413.com';.

Here is my request:

    $  .ajax({
        dataType: 'json',
        data: { parseAsHtml: true, cli: 'help' },
        url: 'http://api.u413.com/',
        success: function (response) {
            alert(response.Command);
        }
    });

Dev tools does record this request but the results are odd. Firstly, there is no response. None. If you click the request and click the response tab in dev tools it simply says “The request has no data available.” Also, when using jquery jsonp normally it automatically appends the request with a query string variable callback=blahblah, but that is not happening here either.

It’s almost as if jquery is detecting that the domain is different and changing the way it makes ajax requests. If I modify the ajax request to be on the same domain then the request appears in the XHR tab where it belongs.

    $  .ajax({
        dataType: 'json',
        crossDomain: false,
        data: { parseAsHtml: true, cli: 'help' },
        url: 'http://dev.u413.com/',
        success: function (response) {
            alert(response.Command);
        }
    });

Why does this happen? The browser shouldn’t complain about cross-domain problems since I set document.domain to a common suffix of both sub-domains as per the guidelines on the same origin policy. The browser isn’t complaining about anything and the console remains free of errors, but I don’t think these requests are being made correctly by jQuery.

Any help is much appreciated.

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/cross-subdomain-ajax-request-with-jquery-always-results-in-jsonp-even-when-document-domain-is-set-correctly/feed/ 0
Ajax results back to mysql https://jqueryplugins.info/2011/10/ajax-results-back-to-mysql/ https://jqueryplugins.info/2011/10/ajax-results-back-to-mysql/#comments Tue, 11 Oct 2011 15:14:21 +0000 Admin https://jqueryplugins.info/2011/10/ajax-results-back-to-mysql/ Post link: Ajax results back to mysql

I am trying to send the results of the current drag drop state back to mysql using ajax/php. With some help the drag and drop jquery feature is all working...

]]>
Post link: Ajax results back to mysql

I am trying to send the results of the current drag drop state back to mysql using ajax/php.
With some help the drag and drop jquery feature is all working perfectly however sadly jquery/ajax is really not in my bag of tricks ..

http://jsfiddle.net/ambiguous/FMKmj/ (Credit mu)

Tearing my hair out , any ideas ?

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/ajax-results-back-to-mysql/feed/ 0
$.ajax send POST and receive JSON https://jqueryplugins.info/2011/10/ajax-send-post-and-receive-json/ https://jqueryplugins.info/2011/10/ajax-send-post-and-receive-json/#comments Sun, 09 Oct 2011 13:19:40 +0000 Admin https://jqueryplugins.info/2011/10/ajax-send-post-and-receive-json/ Post link: $.ajax send POST and receive JSON

I want to send a POST request to a PHP script which then will return a JSON string. I am wondering if this is possible using $ .ajax method? newest...

]]>
Post link: $.ajax send POST and receive JSON

I want to send a POST request to a PHP script which then will return a JSON string.

I am wondering if this is possible using $ .ajax method?

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/ajax-send-post-and-receive-json/feed/ 0
Ajax loade View can’t load javascript https://jqueryplugins.info/2011/10/ajax-loade-view-cant-load-javascript/ https://jqueryplugins.info/2011/10/ajax-loade-view-cant-load-javascript/#comments Fri, 07 Oct 2011 20:17:58 +0000 Admin https://jqueryplugins.info/2011/10/ajax-loade-view-cant-load-javascript/ Post link: Ajax loade View can’t load javascript

I’m trying to load some views using ajax, and they are loading OK. But the scripts they have, are not being loaded on the specific section. Why? View code: @model...

]]>
Post link: Ajax loade View can’t load javascript

I’m trying to load some views using ajax, and they are loading OK.

But the scripts they have, are not being loaded on the specific section. Why?

View code:

@model INTREPWEB.Models.BoardingViewModel
@{
    ViewBag.Title = "Create";

    if (IsAjax)
    {
        Layout = null;
    }
}
@using (Html.BeginForm())
{
    @Html.Partial("CreateEdit")
}
@section Scripts{
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/jquery-ui-timepicker-addon.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/intrep-datetime.js")" type="text/javascript"></script>
}

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/ajax-loade-view-cant-load-javascript/feed/ 0