logo
down
shadow

Conditional parameters for AJAX function


Conditional parameters for AJAX function

By : Venugopaal. K
Date : November 22 2020, 10:56 AM
wish of those help I have a piece of code which is like this.. , Are you able to the same functionality by using variable?
code :
var parameter = ''
var v = $('#time_type').val();
if(v == 'custom')
{
 var st = $('#start_time').val();
 var en = $('#end_time').val();
 parameter = "{'time_type':v,'func':'show_datatable','start_row':outer_start_row,'limit':outer_limit }";
}
else
{
    parameter = " {'time_type':v,'func':'show_datatable','start_row':outer_start_row,'limit':outer_limit}"
}

ajaxcall_continue = $.post("ajax.php",parameter,
            function(response)
            {
                /*---- function body ----*/
            },'json');


Share : facebook icon twitter icon
SQL conditional where Clause executing using querystring parameters - If function needed?

SQL conditional where Clause executing using querystring parameters - If function needed?


By : Hafeez
Date : March 29 2020, 07:55 AM
should help you out You can use COALESCE-
code :
COALESCE(@Feedback, 'Not Specified')
....WHERE     ((MemberId = COALESCE(@MemberID, 'Not Specified'))  
AND ((LocationId = COALESCE(@LocationID, 'Not Specified'))   
AND ((UnitUserField1 = COALESCE(@UUF1, 'Not Specified')) .....
PostgreSQL conditional use of function parameters

PostgreSQL conditional use of function parameters


By : Abbey
Date : March 29 2020, 07:55 AM
With these it helps I'd like to know how to use a function parameter conditionaly. This is my function, and you can read the comment inside the query: , Try something like:
code :
AND (media.status_Id = statusId OR statusId = -1)
Multiple call from same javascript function with ajax, object in parameters not the same between the function body and t

Multiple call from same javascript function with ajax, object in parameters not the same between the function body and t


By : Jake
Date : March 29 2020, 07:55 AM
seems to work fine The problem was related to the fact that dateObj was an observable from knockout and each time I was calling dateObj(). It was recalculating the value. I had to pass not a knockout observable to the function LoadExactResult, but a real object
code :
function LoadExactResult(dateObj) {
    //method body
        var payload = {
            searchCriteriaParam: "",
        };

        console.log(moment() + " - Calling Exact Date: " + dateObj.Date());
        dateObj.IsAllFlightLoading(true);
        $.ajax({
            url: 'bla/bla',
            data: payload,
            cache: false,
            success: function(result) {
                console.log(moment() + " - Exact Date Success: " + dateObj.Date());
                // ajax body.
            }
        });
}
Conditional parameters in function definition PHP

Conditional parameters in function definition PHP


By : user2915768
Date : March 29 2020, 07:55 AM
hope this fix your issue You can pass in a default, but otherwise no you cannot pass in a conditional statement... You could pass in an array for the second parameter to make it easier if desired though..
code :
function attachFile($function_method = "standard", $options = array())
{
  if ( $function_method == "standard" )
  {
    $next_parameter_for_classic_method = $options['next_parameter_for_classic_method '];
  }
  else if ( $function_method == "other_method" )
  {
    $next_parameter_for_other_method = $options['next_parameter_for_other_method'];
  }
}
attachFile('other_method', array('next_parameter_for_other_method'=>'someParameterValue'));
how to a php function which does not parameters from ajax?

how to a php function which does not parameters from ajax?


By : aljon a.
Date : March 29 2020, 07:55 AM
hop of those help? jQuery's AJAX method expects an object with key:value pairs (or a string) for the data field.
Like Quentin said you can't call PHP functions from AJAX, only complete pages. If you want to communicate "run this function" you will have to use $_POST data like this:
code :
$("#history").click(function(){
    $.ajax({
        url: "./function.php",
        type: "POST",
        data: {function:"displayBookingHistory"},
        dataType: "JSON",
        success: function(data) { 
            console.log("hellosdasdasds");
            $("#universalLogin").append(data);
        }
    }); 
})
if(isset($_POST["function"]){
    $function = $_POST["function"];
    if($function=="displayBookingHistory"){
        displayBookingHistory();
    }
}
Related Posts Related Posts :
  • Jquery and create html on the fly
  • jQuery Validation not validating on button click
  • Jquery Draggable/Droppable appending multiple divs
  • jQuery selector not working properly. Possible Sizzle bug?
  • enable anchor in twitter bootstrap modal
  • jQuery keydown : Wait for previous event to finish
  • why magnific popup ajax box closes if clicked on content
  • JQPlot pie charts "jqplotDataClick" event fires multiple times
  • Show div as the page scrolls on div height
  • Keypress event for ajax call does not work
  • responsive/fluid jQGrid with Twitter Bootstrap
  • IE10 does not seem to fire load event
  • Remove tipTip tool tip
  • jquery datepicker changing unavailable dates in one instance
  • TableTools plugin export buttons are not working
  • Prepopulate jquery token input textbox
  • Open a fancybox link with ajax
  • Getting jQuery and AngularJS content assist / auto-complete in eclipse for standalone HTML "file"
  • TR alternate background colour with unequal number of TD
  • DATATABLE jQuery TH and TD alignment
  • Jquery UI Convert Select's to Range Slider
  • Change text in text field according to link that has been clicked
  • Animate addClass + removeClass transitions?
  • knockout ajax call data-BIND
  • How do I create a variable with a number based on an element's number position using jquery?
  • Prevent fixed position element from flickering during jQuery animation
  • points are not visible clearly in nvd3 ghaph
  • How to write a regular expression for IP address format
  • Animate 3 DIVs from right to left when page is loading.
  • How to pivot columns in free jqgrid 4.15.4
  • the jquery method works fine but when made as a function not working
  • Show/hide text doesn't work when targeting link within div
  • multiple autocomplete search input fields
  • Display image in cell using Jquery jTable
  • jQuery and Wordpress - Scripts not working
  • flickering when mouse over, .hover() show/hide div(s)
  • Using Django's JSONResponseMixin to respond to AJAX requests
  • Unable to render charts using Wicked PDF
  • Style to dynamically created elements
  • hover not working for items in list
  • Keep server session alive automatically based on activity / input, using JQuery
  • jQuery load() taking a long time
  • Change / Exchange values in textboxes on text change in jquery
  • Unslider arrow code overriding slider options
  • what is the traditional way of sorting search results?
  • Do the action when the DIV comes in the display area of the browser with jQuery
  • jQuery slideshow overlapping CSS ribbon
  • JQuery animate function dont work
  • problems charts jquery highcharts
  • How to reset the select box values in Jquery sumoselect Multi select plugin
  • css absolute position on top of another element
  • How use jQuery String variable in html body
  • Get a row from table in view on modal bootstrap using codeigniter
  • How to make the effect of a div that covers an other div when scrolling?
  • Data binding using a button
  • How do i replace all dot in string to Underscore?
  • grab non-sibling element with jquery
  • Select a word and click it
  • Trigger modal instead redirect to /users/sign_in path, Rails 4 with devise
  • Combining Parent theme JS and CSS
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org