Jquery serialize function with file upload [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a jquery function:
$.ajax({
type: "POST",
url: "submit.php",
contentType:'multipart/form-data',
data: $('#regForm').serialize(),
dataType: "json",
its work perfectly but image and files will not be send by this. how can I resolve it?

You cannot upload files directly with Ajax, but you can use an hidden iframe, and send form data using the target="iframe_name" attribute in <form>, see this tutorial: http://www.coursesweb.net/ajax/upload-images

Related

using ajax url to call php file [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Cant seem to connect the ajax url to a php file. I've been fiddling around for ages.
File path of JavaScript: h******ze.com/public_html/wp-content/themes/buddyboss-theme-child/assets/js
needs to be be linked to file path PHP:
h******ze.com/public_html/wp-content/plugins/buddyboss-platform/bp-templates/bp-nouveau/buddypress/activity/user-duration.php
setInterval(function(){
$.ajax({
url: '/public_html/wp-content/plugins/buddyboss-platform/bp-templates/bp-nouveau/buddypress/activity/user-duration.php',
success: function(data) {
$('.result').html(data);
}
});
}, 3000);
Assuming the website is visible at h???????ze.com and not h??????ze.com/public_html your URL should be /wp-content/plugins/buddyboss-platform/bp-templates/bp-nouveau/buddypress/activity/user-duration.php
public_html is the root of your website and will contain index.php so you need to point it there. The browser has no access to anything before this in the URL you are using.

How to save image to google drive using php [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
i want to save image on google drive on button click using core php. I don't know anything about it. Got some examples of API but i don't know about API and all. So please give me link or solution that describes from initial. Thank You
you could use DROPzone & then connecto to google
imagesDropzoneInstance = new Dropzone '#imagesDropzone',
url: 'https://www.googleapis.com/upload/drive/v2/files?uploadType=media'
method: 'post'
maxFileSize: 5
paramName: 'images-dropzone-input'
headers:
'Authorization': "Bearer #{ uploadBundle.accessToken }"
addRemoveLinks: 'dictRemoveFile'
imagesDropzoneInstance.uploadFiles = (files) ->
uploadFiles: (files) ->
.. copy the uploadFiles method of Dropzone, modify, then paste here..
# Add the end:
xhr.send files[0] # This overrides the default upload behavior.
but my personal favourite is CLoudinary

Updating contents without refreshing? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to update a division of my webpage updated frequently. But the contents of the division is to be loaded from another file on the server which is unable to be accessed from the file. I have made the access for the first time through PHP on the server. When I'm updating the information, the javascript is on client-side and I'm unable to access it.Also, the meta tag refreshes the entire webpage. I just want to update the division
What are the ways to solve this problem?
You could do this with jQuery and AJAX
like this:
$.get('/route/to/file', { args }, function(data) {
$('#some-container').html(data);
});
If you need it to be fully realtime, you could also use Socket.io:
var ws = io( ... );
ws.on('some.realtime.event', function(data) {
$('#some-container').html(data);
});

Outside Website Custom Search in Joomla [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I need to create a custom search box that leads to an outside url and I'm trying to figure out the best way to do this in Joomla 3.0
For example: We need to create a text field with character input and have a button that when clicked takes the data in the text field and inserts it into the "variable" part of this URL and then takes you to this URL:
https://forexample.com/storefront/search.do;jsessionid=CD66CBFCC5658D6C9327AA269764EBB2?searchType=keyword&keyword="variable"&emailAddress=
You could use jQuery:
$("button").click(function() {
var variable = $("#textbox").val();
window.location.replace("yoururl&" + variable);
})

Simultaneously adding points and linking [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
i got this simple points system, where when a user clicks on the image it adds 20 points to the database through a mysql query. It works, however, I'm trying to make it so that when a user clicks on the image that it not only adds points to a users database but also goes to a website. I added correctly but then it links but doesn't add points. Any help would be appreciated.
Use Ajax for inserting points in your database and after response(in your success method) send it to your desired URL.
$.ajax({
type: "POST",
url: '/test/points.php',
data: formData,
success: function (dataCheck) {
if (dataCheck) {
window.location = 'www.example.com';
}
}
});

Categories