I want to send a cross domain ajax request but I am getting below error. I need to allow others send ajax requests to …
Read MoreAjax
Jquery- Check if is valid price or not
Check the valid price in Jquery. If the price is valid or not.It returns TRUE or FALSE. function CheckValidPrice(price=0){ var tempPrice = Math.round(price * 100)/ …
Read MoreRedirect with PHP after ajax call
Redirect with PHP after ajax call $(‘#button_name’).click(function() { var save_sale = 1; $.ajax({ type: ‘GET’, url: ‘page.php’, data: {save_sale: save_sale}, success: function(data) { window.location.href = …
Read MoreHow to check ajax request or not
if (!empty($_SERVER[‘HTTP_X_REQUESTED_WITH’]) && strtolower($_SERVER[‘HTTP_X_REQUESTED_WITH’]) == ‘xmlhttprequest’ ) { // It is ajax Request }
Read Morehow to remove div using javascript
var element = document.getElementById(“element-id”); element.parentNode.removeChild(element);
Read Morehow to encode json data in php
Encode: json_encode( array(‘id’=>$i, ‘name’ => $row[‘name’]) ); Or $arr = array( ‘id’=>$i, ‘name’ => $row[‘name’], ); json_encode($arr); Decode: $decoded = json_decode($arr);
Read MoreHow to call two or more ajax request parallely in php
<script> $(document).ready(function() { $(document).on(“click”, “._SP12_MR11″, function() { var datastring = {‘DSUC’:SMJX_SMR_SUC,’SRCON’:SMJX_SRCH_ON, ‘LCNT’:SMJX_SMR_LST_CNT,}; $.when( $.ajax({ url:'<?php echo base_url().”search-ax-shwmre-st”;?>’, type: ‘POST’, …
Read MoreIn Show more on click show more button script like this-works
<script> $(document).ready(function() { $(document).on(“click”, “._SP12_SHOWMORE”, function() { var SMJX_SRCH_DPERPG = 5; var SMJX_SMR_SUC = $(“._SP12_SHOWMORE”).attr(‘data-srch-uc’); var SMJX_SMR_LST_CNT = $(“._SP12_SHOWMORE”).attr(‘data-lstcnt’); var SMJX_SRCH_ON …
Read MoreHow to call ajax request one after another in php
<script> $(document).ready(function() { $(document).on(“click”, “._SP12_SHOWMORE”, function() { var datastring = {‘SRCON’:SMJX_ON, ‘LCNT’:SMJX_LST_CNT,}; // FIRST AJAX REQUEST:: $.ajax({ url:'<?php echo base_url().”search-rd”;?>’, type: …
Read MoreHow to check if the request is an AJAX request with PHP
if (!empty($_SERVER[‘HTTP_X_REQUESTED_WITH’]) && strtolower($_SERVER[‘HTTP_X_REQUESTED_WITH’]) == ‘xmlhttprequest’ ) { // This is ajax request. // write your code here. }
Read More