Jquery ajax php without refreshing new resume (photo upload and cropping)

Source: Internet
Author: User


Flowchart


Image Upload reference blog
For more information about image uploading, see. The basic process is the same. You have modified some methods suitable for this function. Reference source code
Plug-in list
1. JQUERY plug-in
2. Select imgareaselect as the client image.
3. uploadify upload function
4. piphp_uploadfile.php uploads files
5. piphp_imagecrop.php Image

Image uploading and resume Summary
1. When an image is uploaded, a timestamp is input and a specific character is appended. md5 encryption is used to obtain the unique name of the cache file. After the resume is entered, the file will be deleted.
2. ajax transmission,
Json Data Format
Var eduField = {
'Resume _ idcard ':'',
'Resume _ EDU_STARTDATE ':'',
'Resume _ EDU_ENDDATE ':'',
'Resume _ EDU_SCHOOL ':'',
'Resume _ EDU_TEL ':''
}
After JSON. stringify (eduField) Parsing
Can be submitted to the background by ajax
$. Ajax ({
Type: "POST ",
Url: "resume_save.php ",
Data: data
BeforeSend: function (){
$ ("# Submit"). attr ("disabled", true). val ("submit... ");
},
Success: function (data ){
Var jsonresult = JSON. parse (data); // parses the background json format back to the object. You can directly point out the property value or obtain the value jsonresult ['key'] in an array-like way.
..........
Jsonresult. step
}
});

Retrieve data parsing in the background
Stripslashes removes the escape characters in the data from the reverse definition \
Parse the json data
Json_decode (stripslashes ($ _ REQUEST ['data']);
The data is an object.

Encode the background arrary or object data and return it to the front-end page
Json_encode ($ jsonarr );

Reception data
JSON. parse (data)
Read data

3. gbk and utf8 Encoding Problems. Www.2cto.com
Iconv ("gb2312", "UTF-8 // IGNORE", $ data); // gb2312-> UTF-8 here // IGNORE indicates an error message indicating the conversion is ignored. As for why there are many google websites.

4. Some form verification to prevent database injection and Other filtering.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.