 ### Best way to POST Form data, File via jQuery AJAX

In programming, you often required to POST form data via jQuery AJAX. Posting normal data via AJAX is the easiest task. But Posting an image, File through AJAX is quite tricky. Either you need to include plugin/library that does the same job or you need to do RD on this. But in some projects, you do not want to include those plugins/libraries. Here in this article, I will show you how you can POST your form data, image or FILE easily. Make this your habit in programming to call AJAX in this way and you will never face such problems. You will get your all data (normal data, image, FILES) on server side language. HTML File / Form

Javascript … ### Get the Minimum & Maximum Sum of an array value in PHP

Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. For example,  arr = [1,3,5,7,9]. Our minimum sum is 1 + 3 + 5 + 7 = 16 and our maximum sum is 3 + 5 + 7 + 9 = 24 . We would print.

Function Description Complete the miniMaxSum function in the editor below. It should print two space-separated integers on one line: the minimum sum and the maximum sum of 4 of 5 elements. miniMaxSum has the following parameter(s): arr: an array of 5 integers Input Format … ### Get 2D array’s diagonal values in PHP

Sometimes is programming line you may need diagonal values of a 2D array. Today in this article I will help you how you can get 2D array’s diagonal values in PHP programming language. Before the start, we should know the logic behind the function. Let suppose we have an array i.e.

Here, diagonal values will be. ar1 = 1,5,9 and ar2 = 3,5,7. We should check that array must be a square. If the input array is not a square we should throw an exception because error handling is the best practice. Here is the code that will fetch diagonal values from a 2D array in PHP. View the code on Gist. ### Diagonal difference of 2D array – PHP

Given a square matrix, calculate the absolute difference between the sums of its diagonals. For example, the square matrix arr is shown below:

The left-to-right diagonal = 1 + 5 + 9 = 15. The right to left diagonal = 3 + 5 + 9 = 17 . Their absolute difference is  |15 – 17| = 2. Function description Complete the diagnoalDifference  function in the editor below. It must return an integer representing the absolute diagonal difference. diagonalDifference takes the following parameter: arr: an array of integers . Input Format The first line contains a single integer, , the number of rows and columns in the matrix . Each of the next lines describes a row arr[I] , and consists of n space-separated … ### Two strings, a and b, are said to be twins only if

Two strings, a and b, are said to be twins only if they can be made equivalent by performing some number of operations on one or both strings. There are two possible operations: SwapEven: Swap a character at an even-numbered index with a character at another even-numbered index. SwapOdd: Swap a character at an odd-numbered index with a character at another odd-numbered index. For example, a = “abcd” and b = “cdab” are twins because we can make them equivalent by performing operations. Alternatively, a = “abcd” and b = “bcda” are not twins (operations do not move characters between odd and even indices), and neither are a = “abc” and b = “ab” (no amount of operations will insert a ‘c’ into string b). Complete the twins function in the editor below. It has two parameters: An array of n strings named a. An …